Fix rendering of empty pane in mobile navigation when no headlines are given

This commit is contained in:
squidfunk 2016-12-30 21:11:05 +01:00
parent d7ba0134a0
commit ca0de52b45
2 changed files with 26 additions and 8 deletions

View File

@ -24,14 +24,22 @@
</li>
{% elif nav_item == page %}
<li class="md-nav__item">
{% set toc = page.toc %}
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
{% if "\x3ch1 id=" in page.content %}
{% set toc = (toc | first).children %}
{% endif %}
{% if toc and (toc | first) %}
<label class="md-nav__link md-nav__link--active" for="toc">
{{ nav_item.title }}
</label>
{% endif %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link md-nav__link--active">
{{ nav_item.title }}
</a>
{% if page.toc %}
{% include "partials/toc.html" %}
{% endif %}
</li>
{% else %}
<li class="md-nav__item">

View File

@ -57,22 +57,32 @@
<!-- Main navigation item with nested items -->
{% elif nav_item == page %}
<li class="md-nav__item">
{% set toc = page.toc %}
<!-- Active checkbox expands items contained within nested section -->
<input class="md-toggle md-nav__toggle" data-md-toggle="toc"
type="checkbox" id="toc" />
<!-- Nasty hack - see partials/toc.html for more information -->
{% if "\x3ch1 id=" in page.content %}
{% set toc = (toc | first).children %}
{% endif %}
<!-- Expand active pages -->
{% if toc and (toc | first) %}
<label class="md-nav__link md-nav__link--active" for="toc">
{{ nav_item.title }}
</label>
{% endif %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
class="md-nav__link md-nav__link--active">
{{ nav_item.title }}
</a>
<!-- Show table of contents -->
{% if page.toc %}
{% include "partials/toc.html" %}
{% endif %}
</li>
<!-- Main navigation item -->