mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03: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 %}
|
||||
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||
{% set first = toc | first %}
|
||||
{% if first is defined and first.level == 1 %}
|
||||
{% if first and first.level == 1 %}
|
||||
{% set toc = first.children %}
|
||||
{% endif %}
|
||||
{% if toc is iterable %}
|
||||
{% if toc %}
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
{{ nav_item.title }}
|
||||
<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">
|
||||
{{ nav_item.title }}
|
||||
</a>
|
||||
{% if toc is iterable %}
|
||||
{% if toc %}
|
||||
{% include "partials/toc.html" %}
|
||||
{% endif %}
|
||||
</li>
|
||||
|
@ -5,10 +5,10 @@
|
||||
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
|
||||
{% set toc = page.toc %}
|
||||
{% set first = toc | first %}
|
||||
{% if first is defined and first.level == 1 %}
|
||||
{% if first and first.level == 1 %}
|
||||
{% set toc = first.children %}
|
||||
{% endif %}
|
||||
{% if toc is iterable %}
|
||||
{% if toc %}
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
{{ lang.t("toc.title") }}
|
||||
|
@ -102,12 +102,12 @@
|
||||
|
||||
<!-- Hack: see partials/toc.html for more information -->
|
||||
{% set first = toc | first %}
|
||||
{% if first is defined and first.level == 1 %}
|
||||
{% if first and first.level == 1 %}
|
||||
{% set toc = first.children %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Render table of contents, if not empty -->
|
||||
{% if toc is iterable %}
|
||||
{% if toc %}
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
{{ nav_item.title }}
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
@ -121,7 +121,7 @@
|
||||
</a>
|
||||
|
||||
<!-- Show table of contents -->
|
||||
{% if toc is iterable %}
|
||||
{% if toc %}
|
||||
{% include "partials/toc.html" %}
|
||||
{% endif %}
|
||||
</li>
|
||||
|
@ -33,12 +33,12 @@
|
||||
directly continue with the children of the anchor.
|
||||
-->
|
||||
{% set first = toc | first %}
|
||||
{% if first is defined and first.level == 1 %}
|
||||
{% if first and first.level == 1 %}
|
||||
{% set toc = first.children %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Render item list -->
|
||||
{% if toc is iterable %}
|
||||
{% if toc %}
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
{{ lang.t("toc.title") }}
|
||||
|
Loading…
Reference in New Issue
Block a user