Generate archive
This commit is contained in:
parent
c59c266ee1
commit
d1eb6f1762
2 changed files with 27 additions and 1 deletions
|
@ -222,6 +222,31 @@ method generate-index($db) {
|
||||||
"<!doctype html>$html"
|
"<!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) {
|
sub icon($icon) {
|
||||||
i(:class("bx bx-$icon"))
|
i(:class("bx bx-$icon"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,8 @@ class PostDB {
|
||||||
}
|
}
|
||||||
# Render the index
|
# Render the index
|
||||||
$out-dir.add('index.html').spurt: $config.generate-index(self);
|
$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: Render the rss/atom feed
|
||||||
# TODO: Symlink the about article
|
# TODO: Symlink the about article
|
||||||
die "Not Implemented"
|
die "Not Implemented"
|
||||||
|
|
Loading…
Add table
Reference in a new issue