Render changelogs in reverse with pagination

This commit is contained in:
Helen Chong 2024-04-17 00:10:34 +08:00
parent e870d62800
commit 66a1b47779
1 changed files with 23 additions and 3 deletions

View File

@ -6,12 +6,32 @@ desc: Changelog of my website.
metadata: metadata:
type: article type: article
date: 2023-01-09 date: 2023-01-09
pagination:
data: collections["changelogs"]
size: 20
alias: changelogs
reverse: true
permalink: "/{{ page.fileSlug }}{% if pagination.pageNumber > 0 %}/page/{{ pagination.pageNumber + 1 }}{% endif %}/"
--- ---
<h2>Latest Changelog:</h2> <h2>Latest Changelogs</h2>
<article> <article>
{% for log in collections["changelog 2024"] | reverse %} {% for log in changelogs %}
<h3>{{ log.data.title }}</h3> <h3>{{ log.data.date | niceDate }}</h3>
{{ log.templateContent | safe }} {{ log.templateContent | safe }}
{%- endfor %} {%- endfor %}
</article> </article>
<p class="center-text">
{% if pagination.href.previous %}
<a href=" {{ pagination.href.previous }}">Previous</a>
{% else %}
Previous
{% endif %}
/
{% if pagination.href.next %}
<a href=" {{ pagination.href.next }}">Next</a>
{% else %}
Next
{% endif %}
</p>