Gestion des poids propres

This commit is contained in:
vincent 2022-09-25 15:19:38 +02:00
parent dfa89254a9
commit f8b5a2e1ba
1 changed files with 70 additions and 30 deletions

View File

@ -3,6 +3,45 @@
{% set sec = get_section(path=sec) %}
{% set maxlevel = hierarchy | length %}
{# Ici on regarde si toutes les sous-sections et pages contenues ont #}
{# une variable weight_custom #}
{% set temoin = true %}
{% set liste = [] %}
{% if sec.subsections %}
{% for s in sec.subsections %}
{% set s_temp = get_section(path=s) %}
{% if not s_temp.extra.weight_custom %}
{% set_global temoin = false %}
{% else %}
{% set_global liste = liste | concat(with=s_temp) %}
{% endif %}
{% endfor %}
{% endif %}
{% if sec.pages %}
{% for p in sec.pages %}
{% if not p.extra.weight_custom %}
{% set_global temoin = false %}
{% else %}
{% set_global liste = liste | concat(with=p) %}
{% endif %}
{% endfor %}
{% endif %}
{# Si toutes les sous-sections et pages ont une variable weight_custom, #}
{# on classe selon elle. Sinon, on utilise la méthode classique. #}
{% if temoin %}
// classer ici
{% else %}
{% if sec.subsections %}
{% for s in sec.subsections %}
{% set p = get_section(path=s) %}
@ -44,6 +83,7 @@
</div>
{% endfor %}
{% endif %}
{% endif %}
{% endmacro navsection %}
{% macro navmenu(current) %}