Skip to content

Commit 4ad5a24

Browse files
committed
mkdocs-material: fix displaying arrow for sections with 1 child page
Fixes #9
1 parent fa0de5c commit 4ad5a24

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mkdocs_section_index/rewrites.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ def _transform_material_nav_item_template(src: str) -> str:
5858
return src.replace(
5959
"{% set indexes = [] %}",
6060
"{% set indexes = [nav_item] if nav_item.url else [] %}",
61+
).replace(
62+
"{% if nav_item.children | length > 1 %}",
63+
"{% if nav_item.children %}",
6164
)
6265

6366
# The above only for versions >= 7.3, the below only for versions < 7.3.

tests/rewrites/material-nav-item-4.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ output: |
131131
{% set class = "md-nav__link--active" if index == page %}
132132
<div class="md-nav__link md-nav__link--index {{ class }}">
133133
<a href="{{ index.url | url }}">{{ nav_item.title }}</a>
134-
{% if nav_item.children | length > 1 %}
134+
{% if nav_item.children %}
135135
<label for="{{ path }}">
136136
<span class="md-nav__icon md-icon"></span>
137137
</label>

0 commit comments

Comments
 (0)