Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/content/documentation/templates/archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ all post titles ordered by year). However, this can be accomplished directly in
This snippet assumes that posts are sorted by date and that you want to display the archive
in descending order. If those conditions are not true, you need to further
process the list of pages:

```jinja
{% raw -%}
{% for year, posts in section.pages | sort(attribute="year") | group_by(attribute="year") %}
Expand All @@ -36,7 +37,8 @@ process the list of pages:
{% endfor %}
{%- endraw %}
```

You may then invert the ordering of `year` or `date` with the `reverse` filter,
like `{% for post in posts | sort(attribute="date") | reverse %}`.
like `{% raw -%}{% for post in posts | sort(attribute="date") | reverse %}{%- endraw %}`.

Note the need for all posts to have `date` defined.
Loading