Tag Cloud recipe in Cookbook not working correctly

I’m implementing tags on a blog using the ‘Filter collections by tags’ cookbook recipe:

However, when I click a tag to filter the collection the tag cloud updates to only shows tags from the currently listed articles, not all articles. Is this intended? I’d like it to show all tags at all times regardless of the current filter.

Thanks,
Jamie

I solved this by moving:

$tags = $articles->pluck('tags', ',', true);

above:

   if($tag = param('tag')) {
     $articles = $articles->filterBy('tags', $tag, ',');
   }

I don’t know if that was intended or not but it doesn’t make sense. I fixed it.

1 Like