Fixed rendering of section index pages with no other pages

This commit is contained in:
squidfunk 2021-10-02 16:51:47 +02:00
parent e2292808cc
commit 149b0dbc47
2 changed files with 12 additions and 6 deletions

View File

@ -37,9 +37,11 @@
{% set class = "md-nav__link--active" if index == page %}
<div class="md-nav__link md-nav__link--index {{ class }}">
<a href="{{ index.url | url }}">{{ nav_item.title }}</a>
<label for="{{ path }}">
<span class="md-nav__icon md-icon"></span>
</label>
{% if nav_item.children | length > 1 %}
<label for="{{ path }}">
<span class="md-nav__icon md-icon"></span>
</label>
{% endif %}
</div>
{% endif %}
<nav class="md-nav" aria-label="{{ nav_item.title }}" data-md-level="{{ level }}">

View File

@ -86,9 +86,13 @@
{% set class = "md-nav__link--active" if index == page %}
<div class="md-nav__link md-nav__link--index {{ class }}">
<a href="{{ index.url | url }}">{{ nav_item.title }}</a>
<label for="{{ path }}">
<span class="md-nav__icon md-icon"></span>
</label>
<!-- Only render toggle if there's at least one more page -->
{% if nav_item.children | length > 1 %}
<label for="{{ path }}">
<span class="md-nav__icon md-icon"></span>
</label>
{% endif %}
</div>
{% endif %}