diff --git a/material/partials/nav-item.html b/material/partials/nav-item.html
index 1e00ef8e2..651c60120 100644
--- a/material/partials/nav-item.html
+++ b/material/partials/nav-item.html
@@ -15,9 +15,8 @@
{% set base = path %}
{% for nav_item in nav_item.children %}
- {% with path = base + "-" + loop.index | string %}
- {% include "partials/nav-item.html" %}
- {% endwith %}
+ {% set path = base + "-" + loop.index | string %}
+ {% include "partials/nav-item.html" %}
{% endfor %}
diff --git a/material/partials/nav.html b/material/partials/nav.html
index 45929ab23..ba5626eef 100644
--- a/material/partials/nav.html
+++ b/material/partials/nav.html
@@ -16,9 +16,8 @@
{% endif %}
{% for nav_item in nav %}
- {% with path = "nav-" + loop.index | string %}
- {% include "partials/nav-item.html" %}
- {% endwith %}
+ {% set path = "nav-" + loop.index | string %}
+ {% include "partials/nav-item.html" %}
{% endfor %}
diff --git a/src/partials/nav-item.html b/src/partials/nav-item.html
index 8e8e0a14d..eb20e8773 100644
--- a/src/partials/nav-item.html
+++ b/src/partials/nav-item.html
@@ -42,13 +42,12 @@
{{ nav_item.title}}
- {% set base = path %}
+ {% set base = path %}
{% for nav_item in nav_item.children %}
- {% with path = base + "-" + loop.index | string %}
- {% include "partials/nav-item.html" %}
- {% endwith %}
+ {% set path = base + "-" + loop.index | string %}
+ {% include "partials/nav-item.html" %}
{% endfor %}
diff --git a/src/partials/nav.html b/src/partials/nav.html
index 7e3adcdfa..9e008b324 100644
--- a/src/partials/nav.html
+++ b/src/partials/nav.html
@@ -39,9 +39,8 @@
{% endif %}
{% for nav_item in nav %}
- {% with path = "nav-" + loop.index | string %}
- {% include "partials/nav-item.html" %}
- {% endwith %}
+ {% set path = "nav-" + loop.index | string %}
+ {% include "partials/nav-item.html" %}
{% endfor %}