mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2025-02-25 21:58:40 +01:00
Fixed empty table of contents being rendered
This commit is contained in:
parent
9296dc3bca
commit
319db2d57d
@ -40,10 +40,10 @@
|
|||||||
{% set toc = page.toc %}
|
{% set toc = page.toc %}
|
||||||
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
{% set first = toc | first %}
|
{% set first = toc | first %}
|
||||||
{% if first is defined and first.level == 1 %}
|
{% if first and first.level == 1 %}
|
||||||
{% set toc = first.children %}
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc is iterable %}
|
{% if toc %}
|
||||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<a href="{{ nav_item.url | url }}" class="md-nav__link md-nav__link--active">
|
<a href="{{ nav_item.url | url }}" class="md-nav__link md-nav__link--active">
|
||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
</a>
|
</a>
|
||||||
{% if toc is iterable %}
|
{% if toc %}
|
||||||
{% include "partials/toc.html" %}
|
{% include "partials/toc.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
|
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
|
||||||
{% set toc = page.toc %}
|
{% set toc = page.toc %}
|
||||||
{% set first = toc | first %}
|
{% set first = toc | first %}
|
||||||
{% if first is defined and first.level == 1 %}
|
{% if first and first.level == 1 %}
|
||||||
{% set toc = first.children %}
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if toc is iterable %}
|
{% if toc %}
|
||||||
<label class="md-nav__title" for="__toc">
|
<label class="md-nav__title" for="__toc">
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
{{ lang.t("toc.title") }}
|
{{ lang.t("toc.title") }}
|
||||||
|
@ -102,12 +102,12 @@
|
|||||||
|
|
||||||
<!-- Hack: see partials/toc.html for more information -->
|
<!-- Hack: see partials/toc.html for more information -->
|
||||||
{% set first = toc | first %}
|
{% set first = toc | first %}
|
||||||
{% if first is defined and first.level == 1 %}
|
{% if first and first.level == 1 %}
|
||||||
{% set toc = first.children %}
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Render table of contents, if not empty -->
|
<!-- Render table of contents, if not empty -->
|
||||||
{% if toc is iterable %}
|
{% if toc %}
|
||||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
@ -121,7 +121,7 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Show table of contents -->
|
<!-- Show table of contents -->
|
||||||
{% if toc is iterable %}
|
{% if toc %}
|
||||||
{% include "partials/toc.html" %}
|
{% include "partials/toc.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
@ -33,12 +33,12 @@
|
|||||||
directly continue with the children of the anchor.
|
directly continue with the children of the anchor.
|
||||||
-->
|
-->
|
||||||
{% set first = toc | first %}
|
{% set first = toc | first %}
|
||||||
{% if first is defined and first.level == 1 %}
|
{% if first and first.level == 1 %}
|
||||||
{% set toc = first.children %}
|
{% set toc = first.children %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Render item list -->
|
<!-- Render item list -->
|
||||||
{% if toc is iterable %}
|
{% if toc %}
|
||||||
<label class="md-nav__title" for="__toc">
|
<label class="md-nav__title" for="__toc">
|
||||||
<span class="md-nav__icon md-icon"></span>
|
<span class="md-nav__icon md-icon"></span>
|
||||||
{{ lang.t("toc.title") }}
|
{{ lang.t("toc.title") }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user