mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 18:08:31 +07:00
Fix RTD theme toc when pages don't have children.
This commit is contained in:
@@ -1,18 +1,27 @@
|
||||
<ul class="current">
|
||||
{% for nav_item in nav %}
|
||||
{% for nav_item in nav_item.children %}
|
||||
<li class="toctree-l1 {% if nav_item.active%}current{%endif%}">
|
||||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
{% if nav_item == current_page %}
|
||||
<ul>
|
||||
{% for toc_item in toc %}
|
||||
<li class="toctree-l2"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% for toc_item in toc_item.children %}
|
||||
<li><a class="toctree-l3" href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}{% endfor %}
|
||||
{% if nav_item.children %}
|
||||
{% for nav_item in nav_item.children %}
|
||||
<li class="toctree-l1 {% if nav_item.active%}current{%endif%}">
|
||||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
{% if nav_item == current_page %}
|
||||
<ul>
|
||||
{% for toc_item in toc %}
|
||||
<li class="toctree-l2"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% for toc_item in toc_item.children %}
|
||||
<li><a class="toctree-l3" href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<li class="toctree-l1 {% if nav_item.active%}current{%endif%}">
|
||||
<a class="{% if nav_item.active%}current{%endif%}" href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user