Generate archive

This commit is contained in:
Nathan McCarty 2025-02-05 03:28:49 -05:00
parent c59c266ee1
commit d1eb6f1762
2 changed files with 27 additions and 1 deletions

View file

@ -222,6 +222,31 @@ method generate-index($db) {
"<!doctype html>$html"
}
method generate-archive($db) {
my @most-recent =
$db.sorted-posts
.grep(!*.value.hidden)
.map(-> $pair {
self.generate-blurb: $pair.key, $db
});
my $head = self.generate-head(Nil, $db.meta);
my $body = body [
self.site-header: $db.meta;
div :class<post-blurbs>, [
h1 "All Posts"
], @most-recent;
];
my $html =
html :lang<en>, [
$head,
$body
];
"<!doctype html>$html"
}
sub icon($icon) {
i(:class("bx bx-$icon"))
}

View file

@ -90,7 +90,8 @@ class PostDB {
}
# Render the index
$out-dir.add('index.html').spurt: $config.generate-index(self);
# TODO: Render the archive
# Render the archive
$out-dir.add('archive.html').spurt: $config.generate-archive(self);
# TODO: Render the rss/atom feed
# TODO: Symlink the about article
die "Not Implemented"