You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

archive.md 682B

1234567891011121314151617181920212223
  1. +++
  2. title = "Archive"
  3. weight = 90
  4. +++
  5. Zola doesn't have a built-in way to display an archive page, a page showing
  6. all post titles ordered by year. However, this can be accomplished directly in the templates:
  7. ```jinja2
  8. {% for year, posts in section.pages | group_by(attribute="year") %}
  9. <h2>{{ year }}</h2>
  10. <ul>
  11. {% for post in posts %}
  12. <li><a href="{{ post.permalink }}">{{ post.title }}</a></li>
  13. {% endfor %}
  14. </ul>
  15. {% endfor %}
  16. ```
  17. This snippet assumes that posts are sorted by date and that you want to display the archive
  18. in a descending order. If you want to show articles in a ascending order, simply add a `reverse` filter
  19. after the `group_by`.