diff --git a/docs/content/documentation/templates/archive.md b/docs/content/documentation/templates/archive.md index af0252c22..678185a02 100644 --- a/docs/content/documentation/templates/archive.md +++ b/docs/content/documentation/templates/archive.md @@ -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") %} @@ -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.