Sort pages using PAGES_SORT_ATTRIBUTE only if explicitly defined.

This commit is contained in:
Kevin Chi Yan Tang 2019-04-20 16:44:06 +02:00
parent 8a80be0b78
commit ac49889075

View file

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