Generate pages for individual tags

This commit is contained in:
Nathan McCarty 2025-02-07 01:58:44 -05:00
parent 20ecef3b3f
commit 2072f88711
4 changed files with 35 additions and 7 deletions

View file

@ -370,6 +370,22 @@ method generate-tags-page($db, @tags) {
"<!doctype html>$html"
}
method generate-tag-page($db, $tag) {
my $head = self.generate-head(Nil, $db.meta);
my $body = body [
self.site-header: $db.meta;
self.generate-tag-blurb($db, $tag, 4);
];
my $html =
html :lang<en>, [
$head,
$body
];
"<!doctype html>$html"
}
sub icon($icon) {
i(:class("bx bx-$icon"))
}

View file

@ -108,6 +108,12 @@ class PostDB {
# Generate the tags pages
my @tags = %!posts.values.map(*.tags).flat.unique;
$out-dir.add('tags.html').spurt: $config.generate-tags-page(self, @tags);
my $tags-dir = $out-dir.add('tags/');
mkdir $tags-dir unless $tags-dir.e;
for @tags -> $tag {
$tags-dir.add("$tag.html").spurt:
$config.generate-tag-page(self, $tag);
}
# Render the rss/atom feed
my $atom-path = $out-dir.add('atom.xml');
my $atom = posts-to-atom self;