Just can’t quite figure this out. I would like to list to all blog tags/collections on any blog page.
I have followed the cookbook and so for my blogs page I have the controller:
return function ($page) {
$tag = urldecode(param('tag') ?? '');
$blogs = collection('blogs');
if (empty($tag) === false) {
$blogs = $blogs->filterBy('tags', $tag, ',');
}
return [
'tag' => $tag,
'blogs' => $blogs->paginate(6)
];
};
and render that on the blogs page:
// fetch all tags
$tags = $page->children()->listed()->pluck('tags', ',', true);
?>
<ul class="tags">
<?php foreach ($tags as $tag): ?>
<li>
<a href="<?= url('blogs', ['params' => ['tag' => $tag]]) ?>">
<?= html($tag) ?>
</a>
</li>
<?php endforeach ?>
</ul>
That works great.
I lack the knowledge to get that same list to render on my individual blog pages. The goal is to have an