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