diff --git a/material/partials/nav-item.html b/material/partials/nav-item.html index 8a90ad49c..b8325bc46 100644 --- a/material/partials/nav-item.html +++ b/material/partials/nav-item.html @@ -2,6 +2,7 @@ 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" %} @@ -31,9 +32,7 @@ @@ -65,3 +64,5 @@ {% endif %} +{% endmacro %} +{{ do_nav_item(nav_item, path, level) }} diff --git a/src/partials/nav-item.html b/src/partials/nav-item.html index c9637f158..42187a696 100644 --- a/src/partials/nav-item.html +++ b/src/partials/nav-item.html @@ -23,6 +23,9 @@ {% set features = config.theme.features or [] %} + +{% macro do_nav_item(nav_item, path, level) %} + {% set class = "md-nav__item" %} {% if nav_item.active %} @@ -82,9 +85,7 @@ {% set base = path %} {% for nav_item in nav_item.children %} - {% set path = base ~ "-" ~ loop.index %} - {% set level = level + 1 %} - {% include "partials/nav-item.html" %} + {{ do_nav_item(nav_item, path = base ~ "-" ~ loop.index, level = level + 1) }} {% endfor %} @@ -136,3 +137,7 @@ {% endif %} + +{% endmacro %} + +{{ do_nav_item(nav_item, path, level) }}