Adds next and previous post links.

This commit is contained in:
Zach Leatherman 2020-07-27 15:19:01 -05:00
parent 75e71adb29
commit 61885752b6

View File

@ -6,4 +6,10 @@ templateClass: tmpl-post
{{ content | safe }} {{ content | safe }}
<p><a href="{{ '/' | url }}">← Home</a></p> <hr>
<ul>
{%- set nextPost = collections.posts | getNextCollectionItem(page) %}
{%- if nextPost %}<li>Next: <a href="{{ nextPost.url | url }}">{{ nextPost.data.title }}</a></li>{% endif %}
{%- set previousPost = collections.posts | getPreviousCollectionItem(page) %}
{%- if previousPost %}<li>Previous: <a href="{{ previousPost.url | url }}">{{ previousPost.data.title }}</a></li>{% endif %}
</ul>