Blueprint: show number of tags being used

I had to add “, ‘,’” to the filterBy to make it count as I want (found here):

<?php foreach($tags as $tag): ?>
      <?php $counttag = page('blog')->children()->listed()->filterBy('tags', $tag, ',')->count(); ?>
      <a href="<?= url($page->url(), ['params' => ['tag' => $tag]]) ?>">
    <button type="button">
    #<?= html($tag) ?> (<?= $counttag ?>)
  </button>
      </a>
    <?php endforeach ?>

Thanks for support!

1 Like