mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Activate root tab when there'e an active page on the root level
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
</a>
|
</a>
|
||||||
{% elif nav_item.url == base_url %}
|
{% elif nav_item.url == base_url %}
|
||||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-tabs__link {% if nav_item.active %} md-tabs__link--active {% endif %}">
|
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-tabs__link {% for nav_item_ in nav %} {{nav_item_.children | length}} {% if nav_item_.url == page.url and nav_item_.children | length == 0 %} md-tabs__link--active {% endif %} {% endfor %}">
|
||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -33,14 +33,22 @@
|
|||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Main navigation item -->
|
<!-- Home page -->
|
||||||
|
|
||||||
{% elif nav_item.url == base_url %}
|
{% elif nav_item.url == base_url %}
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Hack: the item should be active, if we're sure that we're on the first
|
||||||
|
level of the tree and the current item doesn't have children
|
||||||
|
-->
|
||||||
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
|
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
|
||||||
class="md-tabs__link
|
class="md-tabs__link
|
||||||
{% if nav_item.active %}
|
{% for nav_item_ in nav %}
|
||||||
md-tabs__link--active
|
{{nav_item_.children | length}}
|
||||||
{% endif %}">
|
{% if nav_item_.url == page.url and
|
||||||
|
nav_item_.children | length == 0 %}
|
||||||
|
md-tabs__link--active
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}">
|
||||||
{{ nav_item.title }}
|
{{ nav_item.title }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user