mkdocs-material/src/nav.html

59 lines
1.6 KiB
HTML

<!-- Render sections -->
{% if nav_item.children %}
<li>
<hr />
<span class="section">{{ nav_item.title }}</span>
<ul>
<!-- Render pages of section -->
{% for nav_item in nav_item.children %}
{% include 'nav.html' %}
{% endfor %}
</ul>
</li>
<!-- Render page link -->
{% else %}
<li>
<a class="{% if nav_item.active %}current{% endif %}"
title="{{ nav_item.title }}" href="{{ nav_item.url }}" >
{{ nav_item.title }}
</a>
<!-- Expand active pages -->
{% if nav_item == current_page %}
<ul>
<!-- Render anchors of active page -->
{% for toc_item in toc %}
<!--
The top-level anchor must be skipped if the article contains a h1
headline, since it would be redundant to the link to the current
page that is located just above the anchor. Therefore we directly
continue with the children of the anchor.
-->
{% if h1 %}
{% for toc_item in toc_item.children %}
<!-- Render anchor -->
<li class="anchor">
<a title="{{ toc_item.title }}" href="{{ toc_item.url }}">
{{ toc_item.title }}
</a>
</li>
{% endfor %}
{% else %}
<!-- Render anchor -->
<li class="anchor">
<a title="{{ toc_item.title }}" href="{{ toc_item.url }}">
{{ toc_item.title }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}