Tagcloud with active class on current tag?

Thanks @andi242. Here’s what eventually worked for me:

<?php $tags = $page->images()->pluck('tags', ',', true); ?>
<?php $p = kirby()->request()->params()->tag(); ?>

<ul>
  <?php foreach($tags as $tag): ?>
  <li>
    <a <?php ecco($tag == $p, ' class="active"') ?> href="<?php echo url('work/tag:' . $tag)?>">
      <?php echo html($tag) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>

Hope this can be helpful for anyone trying to do the same. If anyone has a better solution please let me know.

Thanks!

5 Likes