Add pagination
This commit is contained in:
parent
99b1e8cd76
commit
f87343b4f3
2 changed files with 57 additions and 15 deletions
|
|
@ -1,12 +1,17 @@
|
|||
---
|
||||
title: Devon's Blog
|
||||
layout: article.njk
|
||||
pagination:
|
||||
data: collections.post
|
||||
size: 5
|
||||
alias: posts
|
||||
reverse: true
|
||||
---
|
||||
|
||||
<p>The posts here are sorted by recently modified. That means that if I update a post, it will float back to the top. I'll try to update the excerpts to reflect the changes made.</p>
|
||||
|
||||
<ul class="post-list">
|
||||
{%- for post in collections.post -%}
|
||||
{%- for post in posts -%}
|
||||
<li>
|
||||
<h2><a href="{{ post.url }}">{{ post.data.title }}</a></h2>
|
||||
<small>Last updated {{ post.date | formatDatetimeForHumans }}</small>
|
||||
|
|
@ -14,3 +19,15 @@ layout: article.njk
|
|||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
|
||||
<nav aria-labelledby="pagination-heading" class="pagination">
|
||||
<h2 id="pagination-heading" class="sr-only">Paging Controls</h2>
|
||||
{% if pagination.href.previous or pagination.href.next %}
|
||||
<ol>
|
||||
{% if pagination.href.previous %}<li class="newer-item"><a href="{{ pagination.href.previous }}">Newer</a></li>{% endif %}
|
||||
{%- for pageEntry in pagination.pages %}
|
||||
{%- endfor %}
|
||||
{% if pagination.href.next %}<li class="older-item"><a href="{{ pagination.href.next }}">Older</a></li>{% endif %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
</nav>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue