diff options
| author | Dennis Fink | 2026-11-06 18:26:38 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-06 18:26:38 +0100 |
| commit | 2fc37fa4e2930e7c8603660301b1b0fe80a6c5a8 (patch) | |
| tree | ea4161a44bf0f12258f2fb8b84e28b5e28a330ff /templates | |
| parent | 3ccac9a70669db5cd9d83a1d05b02e0c43cf58c6 (diff) | |
| download | dennisfink.me-2fc37fa4e2930e7c8603660301b1b0fe80a6c5a8.tar.gz dennisfink.me-2fc37fa4e2930e7c8603660301b1b0fe80a6c5a8.zip | |
Add previous and next post navigation
This adds navigation links between adjacent blog posts, allowing readers
to continue browsing without returning to the blog index. The navigation
uses a responsive two-column layout and is excluded from Pagefind
indexing.
Diffstat (limited to '')
| -rw-r--r-- | templates/blog-post.html | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/templates/blog-post.html b/templates/blog-post.html index 6c74033..d08ed2f 100644 --- a/templates/blog-post.html +++ b/templates/blog-post.html @@ -93,4 +93,23 @@ {% endif %} {% endblock %} -{% block content %}{{ render_blog_post(this) }}{% endblock %} +{% block content %} + {{ render_blog_post(this) }} + {% set siblings = this.get_siblings() %} + {% if siblings.next_page or siblings.prev_page %} + <nav aria-label="Post navigation" data-pagefind-ignore> + {% if siblings.next_page %} + <a href="{{ siblings.next_page | url }}" rel="prev"> + <small>← Previous post</small> + <span>{{ siblings.next_page.title }}</span> + </a> + {% endif %} + {% if siblings.prev_page %} + <a href="{{ siblings.prev_page | url }}" rel="next"> + <small>Next post →</small> + <span>{{ siblings.prev_page.title }}</span> + </a> + {% endif %} + </nav> + {% endif %} +{% endblock %} |
