allow to choose a page sort attribute other than alphabetical

This commit is contained in:
Marc-Antoine Parent 2016-11-19 09:27:16 -05:00
parent 6519ff7d32
commit 201ea869dc

View file

@ -90,7 +90,10 @@
{% if pages or LINKS %} {% if pages or LINKS %}
<nav> <nav>
<ul class="list"> <ul class="list">
{% for page in pages|sort(attribute='title') %} {% if not PAGES_SORT_ATTRIBUTE -%}
{% set PAGES_SORT_ATTRIBUTE = 'title' %}
{%- endif %}
{% for page in pages|sort(attribute=PAGES_SORT_ATTRIBUTE) %}
<li><a href="{{ SITEURL }}/{{ page.url }}#{{ page.slug }}">{{ page.title }}</a></li> <li><a href="{{ SITEURL }}/{{ page.url }}#{{ page.slug }}">{{ page.title }}</a></li>
{% endfor %} {% endfor %}