diff --git a/material/partials/nav-item.html b/material/partials/nav-item.html
index b8325bc46..c6a218d04 100644
--- a/material/partials/nav-item.html
+++ b/material/partials/nav-item.html
@@ -2,67 +2,71 @@
This file was automatically generated - do not edit
-#}
{% set features = config.theme.features or [] %}
-{% macro do_nav_item(nav_item, path, level) %}
-{% set class = "md-nav__item" %}
-{% if nav_item.active %}
- {% set class = class ~ " md-nav__item--active" %}
-{% endif %}
-{% if nav_item.children %}
- {% if "navigation.sections" in features and level == 1 + (
- "navigation.tabs" in features
- ) %}
- {% set class = class ~ " md-nav__item--section" %}
+{% macro render_nav_item(nav_item, path, level) %}
+ {% set class = "md-nav__item" %}
+ {% if nav_item.active %}
+ {% set class = class ~ " md-nav__item--active" %}
{% endif %}
-
- {% set checked = "checked" if nav_item.active %}
- {% if "navigation.expand" in features and not checked %}
-
- {% else %}
-
+ {% if nav_item.children %}
+ {% if "navigation.sections" in features and level == 1 + (
+ "navigation.tabs" in features
+ ) %}
+ {% set class = class ~ " md-nav__item--section" %}
{% endif %}
-
-
-
-{% elif nav_item == page %}
-
- {% set toc = page.toc %}
-
- {% if toc | first is defined and "\x3ch1 id=" in page.content %}
- {% set toc = (toc | first).children %}
- {% endif %}
- {% if toc | first is defined %}
-
+ {% elif nav_item == page %}
+
+ {% set toc = page.toc %}
+
+ {% if toc | first is defined and "\x3ch1 id=" in page.content %}
+ {% set toc = (toc | first).children %}
+ {% endif %}
+ {% if toc | first is defined %}
+
+ {{ nav_item.title }}
+
+
+ {% endif %}
+
+ {{ nav_item.title }}
+
+ {% if toc | first is defined %}
+ {% include "partials/toc.html" %}
+ {% endif %}
+
+ {% endif %}
{% endmacro %}
-{{ do_nav_item(nav_item, path, level) }}
+{{ render_nav_item(nav_item, path, level) }}
diff --git a/src/partials/nav-item.html b/src/partials/nav-item.html
index 42187a696..4591668bd 100644
--- a/src/partials/nav-item.html
+++ b/src/partials/nav-item.html
@@ -23,121 +23,124 @@
{% set features = config.theme.features or [] %}
-
-{% macro do_nav_item(nav_item, path, level) %}
+
+{% macro render_nav_item(nav_item, path, level) %}
-
-{% set class = "md-nav__item" %}
-{% if nav_item.active %}
- {% set class = class ~ " md-nav__item--active" %}
-{% endif %}
-
-
-{% if nav_item.children %}
-
-
- {% if "navigation.sections" in features and level == 1 + (
- "navigation.tabs" in features
- ) %}
- {% set class = class ~ " md-nav__item--section" %}
+
+ {% set class = "md-nav__item" %}
+ {% if nav_item.active %}
+ {% set class = class ~ " md-nav__item--active" %}
{% endif %}
-
-
+
+ {% if nav_item.children %}
-
- {% set checked = "checked" if nav_item.active %}
- {% if "navigation.expand" in features and not checked %}
-
- {% else %}
-
+
+ {% if "navigation.sections" in features and level == 1 + (
+ "navigation.tabs" in features
+ ) %}
+ {% set class = class ~ " md-nav__item--section" %}
{% endif %}
-
-
- {{ nav_item.title }}
-
-
-
-
+
+ {% set checked = "checked" if nav_item.active %}
+ {% if "navigation.expand" in features and not checked %}
+
+ {% else %}
+
+ {% endif %}
-
-{% elif nav_item == page %}
-
- {% set toc = page.toc %}
-
-
-
-
-
- {% if toc | first is defined and "\x3ch1 id=" in page.content %}
- {% set toc = (toc | first).children %}
- {% endif %}
-
-
- {% if toc | first is defined %}
-
+
+
{{ nav_item.title }}
- {% endif %}
-
- {{ nav_item.title }}
-
+
+
+ {% set base = path %}
+ {% for nav_item in nav_item.children %}
+ {{ render_nav_item(
+ nav_item,
+ path = base ~ "-" ~ loop.index,
+ level = level + 1)
+ }}
+ {% endfor %}
+
+
+
-
-{% else %}
-