I’m trying to use the Kirby tagcloud plugin to make one giant page of tags, prioritized by popularity and with a count. I’m close to a solution, except the tagcloud plugin seems to only want to pull from one page template. Ideally I’d love it if I could give it multiple templates to pull tags from.
Here’s what I’ve got so far…
<?php $tagcloud = tagcloud(page('episode')) ?> <article class="full"> <ul class="tagcloud episode-tags"> <?php foreach($tagcloud as $tag): ?> <li> <?php $x = 0; ?> <?php $tagmatches = $site->grandChildren()->filterBy('template','episode')->filterBy('tags', $tag->name(), ','); ?> <?php foreach($tagmatches as $tagmatch): $x = $x+1; ?> <?php endforeach ?> <a <?php if ($x > 1): ?> href="<?php echo url::home() ?>/find/tag:<?php echo rawurlencode($tag->name()) ?>" <?php endif ?>><?php echo trim($tag->name()) ?> (<?php echo $x; ?>)</a> </li> <?php endforeach ?> </ul> </article>
…which gives me this result.
That’s great, but I’d like to have the tagcloud function go through the ‘blog’ and ‘other-projects’ templates as well as episode. On a whim, I’ve tried several variants of
<?php $tagcloud = tagcloud(pages('episode', 'blog', 'other-projects) ?>, but those attempts just break the page.