crisp-theme.git

git clone https://git.crispbyte.dev/crisp-theme.git

commit
00b535a
parent
111c859
author
cheddar
date
2025-04-18 20:23:45 +0200 CEST
Generate single page versions of series
5 files changed,  +53, -5
M _includes/layouts/post.njk
+1, -1
1@@ -2,7 +2,7 @@
2 layout: layouts/base.njk
3 ---
4 <article>
5-  <h1>{{ title }}</h1>
6+  <h1 class="post-title">{{ title }}</h1>
7   <div class="about">
8     <address>by <a href="{{ author.url or metadata.author.url }}">
9       {{ author.name or metadata.author.name }}
A _includes/layouts/series_base.njk
+18, -0
 1@@ -0,0 +1,18 @@
 2+<!DOCTYPE html>
 3+<html>
 4+  <head>
 5+    <meta charset="utf-8">
 6+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 7+    <title>
 8+      {% if title %}{{ title  }} - {% endif %}
 9+      {% if series %}{{ series.name }} - {% endif %}
10+      {{ metadata.title }}
11+    </title>
12+    <meta name="description" content="{{ description or metadata.description }}">
13+    <link rel="alternate" href="/feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}">
14+    <link rel="stylesheet" href="/styles.css">
15+  </head>
16+  <body>
17+    {{ content | safe }}
18+  </body>
19+</html>
M _includes/series_list.njk
+1, -0
1@@ -1,5 +1,6 @@
2 <nav>
3   <h2>{{ seriesName }}</h2>
4+  <a href="/series/{{ seriesName | slugify }}/">View on one page</a>
5   <ol>
6   {%- for post in collections.posts | seriesPosts(seriesName) %}
7     {% include "post_link.njk" %}
M _includes/styles/base.css
+8, -4
 1@@ -24,19 +24,23 @@ ol {
 2 }
 3 
 4 hr {
 5-  margin: 20px 0 0 0;
 6+  margin: 10px 0;
 7 }
 8 
 9 article {
10-  padding-bottom: 20px;
11+  padding-bottom: 10px;
12 }
13 
14-article > h1 {
15+article > .post-title {
16   margin-bottom: 0;
17 }
18 
19+nav {
20+  padding: 10px 0;
21+}
22+
23 nav > h2 {
24-  margin-bottom: 0;
25+  margin: 0;
26 }
27 
28 nav > ul {
A content/series_pages.njk
+25, -0
 1@@ -0,0 +1,25 @@
 2+---
 3+layout: layouts/series_base.njk
 4+pagination:
 5+  data: collections.series
 6+  size: 1
 7+  alias: seriesName
 8+permalink: "series/{{ seriesName | slugify }}/"
 9+---
10+
11+<article>
12+<h1>{{ seriesName }}</h1>
13+{%- for post in collections.posts | seriesPosts(seriesName) %}
14+<article>
15+  <h2 class="post-title">{{ post.data.title }}</h2>
16+  <div class="about">
17+    <address>by <a href="{{ post.author.url or metadata.author.url }}">
18+      {{ post.author.name or metadata.author.name }}
19+    </a></address>
20+    <time datetime="{{ post.date | htmlDateString }}">published {{ post.date | readableDate }}</time>
21+  </div>
22+  {{ post.content | safe }}
23+</article>
24+<hr>
25+{%- endfor %}
26+</article>