Add previous and next blog post section
This commit is contained in:
parent
804126d745
commit
1cfbe2d61d
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
layout: main/article
|
||||
---
|
||||
|
||||
{{ content | safe }}
|
||||
|
||||
{%- if collections.posts %}
|
||||
{%- set previousPost = collections.posts | getPreviousCollectionItem %}
|
||||
{%- set nextPost = collections.posts | getNextCollectionItem %}
|
||||
{%- if nextPost or previousPost %}
|
||||
<ul class="blog__post--nextprev">
|
||||
{%- if previousPost %}<li>Previous Post: <a href="{{ previousPost.url }}">{{ previousPost.data.articleTitle }}</a></li>{% endif %}
|
||||
{%- if nextPost %}<li>Next Post: <a href="{{ nextPost.url }}">{{ nextPost.data.articleTitle }}</a></li>{% endif %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
<style>
|
||||
.blog__post--nextprev {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
padding-top: 0.8em;
|
||||
margin-top: 2.5em;
|
||||
border-top: 0.1em solid var(--clr-title-border);
|
||||
}
|
||||
</style>
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"layout": "main/article",
|
||||
"layout": "main/blogpost",
|
||||
"tags": ["posts", "contents", "feed items"],
|
||||
"eleventyComputed": {
|
||||
"title": "{{ articleTitle }} | Blog"
|
||||
|
|
Loading…
Reference in New Issue