Add pagination to blog

This commit is contained in:
gil 2024-06-20 19:39:04 -05:00
parent 115a00b8fc
commit a25850a146

View file

@ -2,14 +2,18 @@
title: Blog
permalink: /blog/
override:tags: []
pagination:
data: collections.blog
size: 2
generatePageOnEmptyData: true
eleventyNavigation:
key: Blog
order: 2
---
{%- for post in collections.blog reversed -%}
{% if forloop.first == true %}<ul>{% endif %}
<ul>
{%- for post in pagination.items %}
<li><a href="{{ post.url }}">{{ post.data.title }}</a>
&mdash; <i>updated <time datetime="{{ post.date | formatDate }}">{{ post.date | formatDate }}</time></i></li>
{% if forloop.last == true %}</ul>{% endif %}
{%- endfor -%}
{% endfor -%}
</ul>