Apologize if this is a basic question, but I think I’m stuck on a conceptual understanding of something related to tags. I have a blog loop on my home page, and I’d like to display the post’s tag linked to a page that contains posts with that tag.
I have the tag fields successfully set up in the panel and displaying correctly on my posts, however I can’t get the links to work right. Do I need to actually create a separate ‘tag’ page and template to link to such a filtered list of posts?
So far, in my templates (both on the home page template and on the single post template), I’m using this to display the tag and constructing the link:
<?php foreach ($page->tags()->split() as $tag): ?> <a href="<?php echo url('/' . url::paramsToString(['tag' => $tag])) ?>">#<?php echo html($tag) ?></a> <?php endforeach ?>
This results in the following output:
Any ideas on what I’m missing? Thinking maybe I need to create a specific, dedicated tag.php page and template to display these? I guess I was assuming that this would still work falling back to the default.php template, but maybe not? Thanks!