Fixed filtering of subsequent index.md files when using section index pages

This commit is contained in:
squidfunk 2021-12-19 11:12:30 +01:00
parent a32760bdee
commit f3926bf444
2 changed files with 8 additions and 11 deletions

View File

@ -21,9 +21,9 @@
{% endif %} {% endif %}
{% set indexes = [] %} {% set indexes = [] %}
{% if "navigation.indexes" in features %} {% if "navigation.indexes" in features %}
{% for item in nav_item.children %} {% for nav_item in nav_item.children %}
{% if item.is_index and not index is defined %} {% if nav_item.is_index and not index is defined %}
{% set _ = indexes.append(item) %} {% set _ = indexes.append(nav_item) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -51,8 +51,7 @@
</label> </label>
<ul class="md-nav__list" data-md-scrollfix> <ul class="md-nav__list" data-md-scrollfix>
{% for nav_item in nav_item.children %} {% for nav_item in nav_item.children %}
{% if "navigation.indexes" in features and nav_item.is_index %} {% if not indexes or nav_item != indexes | first %}
{% else %}
{{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }} {{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -66,9 +66,9 @@
<!-- Determine all nested items that are index pages --> <!-- Determine all nested items that are index pages -->
{% set indexes = [] %} {% set indexes = [] %}
{% if "navigation.indexes" in features %} {% if "navigation.indexes" in features %}
{% for item in nav_item.children %} {% for nav_item in nav_item.children %}
{% if item.is_index and not index is defined %} {% if nav_item.is_index and not index is defined %}
{% set _ = indexes.append(item) %} {% set _ = indexes.append(nav_item) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -110,9 +110,7 @@
<!-- Render nested item list --> <!-- Render nested item list -->
{% for nav_item in nav_item.children %} {% for nav_item in nav_item.children %}
{% if "navigation.indexes" in features and nav_item.is_index %} {% if not indexes or nav_item != indexes | first %}
<!-- Render nothing -->
{% else %}
{{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }} {{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}