Skip to content
Discussion options

You must be logged in to vote

You did it right. You need to copy _layouts/archives.html to your repo and adjust the layout to serve your needs.

I can propose to sort posts by date before iterating over them:

{% assign posts = site.posts | sort: 'date' %}
{% for post in posts %}

Here is the full layout definition:

---
layout: page
# The Archives of posts.
---
{% include lang.html %}

{% assign df_strftime_m = site.data.locales[lang].df.archives.strftime | default: '/ %m' %}
{% assign df_dayjs_m = site.data.locales[lang].df.archives.dayjs | default: '/ MM' %}

<div id="archives" class="pl-xl-3">
  {% assign posts = site.posts | sort: 'date' %}
  {% for post in posts %}
    {% assign cur_year = post.date | date: '%Y' %}
…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant