Finally got around to play with - and implement - tag support 🥳
Reminding you all that this is a 'static' website, meaning a site without a database, but – still based on Laravel.
As describe in this post, the page data is indexed in a yaml file, so adding the tag section to the page data was fairly easy:
hello-tag-support:
title: 'Hello, tag support!'
section: blog
created_at: '2022-09-11 09:39:23'
links: [feature-wishlist]
tags: [pizza, tennis]
Rendering the tags on the page:
@isset($page->tags)
<div class="my-4 float-right">
@each('components.tag', $page->tags, 'tag')
</div>
@endisset
And - finally - on the tag page, show links to the pages containing the tag:
$links = Page::all()->filter(function ($page) use ($tag) {
return collect($page->tags)->contains($tag);
});
Again, performance on a site with thousand of pages: Probably not great. On this site: Totally acceptable.
2021-09-15
Feature wishlist for this site