Generate series list page
This commit is contained in:
parent
baf8d6556b
commit
109165b80e
4 changed files with 49 additions and 8 deletions
|
@ -140,14 +140,16 @@ class PostDB {
|
||||||
$tags-dir.add("$tag.html").spurt:
|
$tags-dir.add("$tag.html").spurt:
|
||||||
$config.generate-tag-page(self, $tag);
|
$config.generate-tag-page(self, $tag);
|
||||||
}
|
}
|
||||||
# TODO: Generate the series pages
|
# Generate the series pages
|
||||||
my $series-dir = $out-dir.add('series/');
|
my $series-dir = $out-dir.add('series/');
|
||||||
mkdir $series-dir unless $series-dir.e;
|
mkdir $series-dir unless $series-dir.e;
|
||||||
for %!series.kv -> $key, $value {
|
for %!series.kv -> $key, $value {
|
||||||
$series-dir.add("$key.html").spurt:
|
$series-dir.add("$key.html").spurt:
|
||||||
series-page($key, self);
|
series-page($key, self);
|
||||||
}
|
}
|
||||||
# TODO: Generate the main series page
|
# Generate the main series page
|
||||||
|
$out-dir.add('series.html').spurt:
|
||||||
|
series-list-page self;
|
||||||
# Render the rss/atom feed
|
# Render the rss/atom feed
|
||||||
my $atom-path = $out-dir.add('atom.xml');
|
my $atom-path = $out-dir.add('atom.xml');
|
||||||
my $atom = posts-to-atom self;
|
my $atom = posts-to-atom self;
|
||||||
|
|
|
@ -103,3 +103,42 @@ sub series-page(Int:D $series-id, $db) is export {
|
||||||
|
|
||||||
show-html $html;
|
show-html $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub series-blurb(Int:D $id, Series:D $series, $db) {
|
||||||
|
my $link = "/series/$id.html";
|
||||||
|
div :class<series-list-blurb>, [
|
||||||
|
div :class<series-list-blurb-title>, [
|
||||||
|
a :href($link), span [
|
||||||
|
h2 $series.title;
|
||||||
|
];
|
||||||
|
p $series.desc;
|
||||||
|
];
|
||||||
|
series-info $series, $db;
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
sub series-list-page($db) is export {
|
||||||
|
my @series = $db.series.sort(*.value.latest-post: $db);
|
||||||
|
my @series-blurbs = ();
|
||||||
|
for @series -> $pair {
|
||||||
|
my $id = $pair.key;
|
||||||
|
my $series = $pair.value;
|
||||||
|
@series-blurbs.push:
|
||||||
|
series-blurb $id, $series, $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $head = generate-head($db.meta);
|
||||||
|
my $body = body [
|
||||||
|
site-header $db.meta;
|
||||||
|
div :class<series-list>, [
|
||||||
|
h1 "All Series"
|
||||||
|
], @series-blurbs;
|
||||||
|
];
|
||||||
|
|
||||||
|
my $html = html :lang<en>, [
|
||||||
|
$head;
|
||||||
|
$body;
|
||||||
|
];
|
||||||
|
|
||||||
|
show-html $html;
|
||||||
|
}
|
||||||
|
|
|
@ -54,10 +54,10 @@ a:visited {
|
||||||
color: var(--dim-0);
|
color: var(--dim-0);
|
||||||
}
|
}
|
||||||
.post-body, .post-header, .post-blurbs, .tags, .tags .tag-blurb-post,
|
.post-body, .post-header, .post-blurbs, .tags, .tags .tag-blurb-post,
|
||||||
.series-header, .series-blurbs {
|
.series-header, .series-blurbs, .series-list {
|
||||||
background-color: var(--bg-0);
|
background-color: var(--bg-0);
|
||||||
}
|
}
|
||||||
.post-blurb, .tags .tag-blurb {
|
.post-blurb, .tags .tag-blurb, .series-list-blurb {
|
||||||
background-color: var(--bg-1);
|
background-color: var(--bg-1);
|
||||||
}
|
}
|
||||||
:not(.tags) .tag-blurb {
|
:not(.tags) .tag-blurb {
|
||||||
|
@ -66,7 +66,7 @@ a:visited {
|
||||||
:not(.tags) .tag-blurb-post {
|
:not(.tags) .tag-blurb-post {
|
||||||
background-color: var(--bg-1);
|
background-color: var(--bg-1);
|
||||||
}
|
}
|
||||||
.post-title, .post-blurbs h1, .series-header h1 {
|
.post-title, .post-blurbs h1, .series-header h1, .series-list h1 {
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
}
|
}
|
||||||
.post-body h2, .post-body h3, .post-body h4 {
|
.post-body h2, .post-body h3, .post-body h4 {
|
||||||
|
|
|
@ -33,7 +33,7 @@ body, .post, .series {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--box-gap);
|
gap: var(--box-gap);
|
||||||
}
|
}
|
||||||
.post, .series {
|
.post, .series, .series-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ body, .post, .series {
|
||||||
.post-body h2, .post-body h3, .post-body h4 {
|
.post-body h2, .post-body h3, .post-body h4 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.post-blurbs, .series-blurbs {
|
.post-blurbs, .series-blurbs, .series-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -118,7 +118,7 @@ body, .post, .series {
|
||||||
border-radius: var(--box-radius);
|
border-radius: var(--box-radius);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.post-blurb {
|
.post-blurb, .series-list-blurb {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: block;
|
display: block;
|
||||||
border-radius: var(--box-radius);
|
border-radius: var(--box-radius);
|
||||||
|
|
Loading…
Add table
Reference in a new issue