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;

View file

@ -53,16 +53,22 @@ a:visited {
.site-tagline {
color: var(--dim-0);
}
.post-body, .post-header, .post-blurbs, .tags, .tag-blurb-post {
.post-body, .post-header, .post-blurbs, .tags, .tags .tag-blurb-post {
background-color: var(--bg-0);
}
.post-blurb, .tag-blurb {
.post-blurb, .tags .tag-blurb {
background-color: var(--bg-1);
}
.post-title, .post-blurbs > h1 {
:not(.tags) .tag-blurb {
background-color: var(--bg-0);
}
:not(.tags) .tag-blurb-post {
background-color: var(--bg-1);
}
.post-title, .post-blurbs h1 {
color: var(--green);
}
.post-body > h2, .post-body > h3, .post-body > h4 {
.post-body h2, .post-body h3, .post-body h4 {
color: var(--fg-1);
}
blockquote {

View file

@ -83,11 +83,11 @@ body, .post {
border-radius: var(--box-radius);
box-sizing: border-box;
}
.post-body > p {
.post-body p {
margin: auto var(--box-margin-horz);
align-self: stretch;
}
.post-title > h1 {
.post-title h1 {
margin-top: 0px;
margin-bottom: 0px;
}
@ -102,7 +102,7 @@ body, .post {
.post-read-time {
text-decoration: underline dotted;
}
.post-body > h2, .post-body > h3, .post-body > h4 {
.post-body h2, .post-body h3, .post-body h4 {
text-align: center;
}
.post-blurbs {