diff --git a/lib/Config.rakumod b/lib/Config.rakumod index c8f31d9..e5a1dd4 100644 --- a/lib/Config.rakumod +++ b/lib/Config.rakumod @@ -222,6 +222,31 @@ method generate-index($db) { "$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, [ + h1 "All Posts" + ], @most-recent; + ]; + + my $html = + html :lang, [ + $head, + $body + ]; + + "$html" +} + sub icon($icon) { i(:class("bx bx-$icon")) } diff --git a/lib/DB.rakumod b/lib/DB.rakumod index 653e4c7..ca3f101 100644 --- a/lib/DB.rakumod +++ b/lib/DB.rakumod @@ -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"