diff --git a/material/partials/nav-item.html b/material/partials/nav-item.html
index 9453d04a721c251bcea722e3b08b5ad5bfb8b59d..60f8b4f3c3706ca41ee35d416d950299a61a129a 100644
--- a/material/partials/nav-item.html
+++ b/material/partials/nav-item.html
@@ -24,12 +24,12 @@
   </li>
 {% elif nav_item == page %}
   <li class="md-nav__item">
-    {% set toc = page.toc %}
+    {% set toc_ = page.toc %}
     <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
     {% if "\x3ch1 id=" in page.content %}
-      {% set toc = (toc | first).children %}
+      {% set toc_ = (toc_ | first).children %}
     {% endif %}
-    {% if toc and (toc | first) %}
+    {% if toc_ and (toc_ | first) %}
       <label class="md-nav__link md-nav__link--active" for="toc">
         {{ nav_item.title }}
       </label>
diff --git a/material/partials/toc.html b/material/partials/toc.html
index b53be3907ee1e461e64404dd95db89fb8eb83df5..8177b0ffed59a516634c89b5ceecbd107774364c 100644
--- a/material/partials/toc.html
+++ b/material/partials/toc.html
@@ -1,12 +1,12 @@
 <nav class="md-nav md-nav--secondary">
-  {% set toc = page.toc %}
+  {% set toc_ = page.toc %}
   {% if "\x3ch1 id=" in page.content %}
-    {% set toc = (toc | first).children %}
+    {% set toc_ = (toc_ | first).children %}
   {% endif %}
-  {% if toc and (toc | first) %}
+  {% if toc_ and (toc_ | first) %}
     <label class="md-nav__title" for="toc">Table of contents</label>
     <ul class="md-nav__list" data-md-scrollfix>
-      {% for toc_item in toc %}
+      {% for toc_item in toc_ %}
         {% include "partials/toc-item.html" %}
       {% endfor %}
     </ul>
diff --git a/src/partials/nav-item.html b/src/partials/nav-item.html
index fe5f535de901191ff71dbdf7559f348d483ef5a3..0ffb600e08df14d9900d22e4e124e5bb02d62898 100644
--- a/src/partials/nav-item.html
+++ b/src/partials/nav-item.html
@@ -57,7 +57,7 @@
 <!-- Currently active page -->
 {% elif nav_item == page %}
   <li class="md-nav__item">
-    {% set toc = page.toc %}
+    {% set toc_ = page.toc %}
 
     <!-- Active checkbox expands items contained within nested section -->
     <input class="md-toggle md-nav__toggle" data-md-toggle="toc"
@@ -65,11 +65,11 @@
 
     <!-- Nasty hack - see partials/toc.html for more information -->
     {% if "\x3ch1 id=" in page.content %}
-      {% set toc = (toc | first).children %}
+      {% set toc_ = (toc_ | first).children %}
     {% endif %}
 
     <!-- Render table of contents, if not empty -->
-    {% if toc and (toc | first) %}
+    {% if toc_ and (toc_ | first) %}
       <label class="md-nav__link md-nav__link--active" for="toc">
         {{ nav_item.title }}
       </label>
diff --git a/src/partials/toc.html b/src/partials/toc.html
index 21e9f2e269955056dbbe407e0872d5ce89ccc906..264eea69ca3ba87c3068aaee9d407b49113859db 100644
--- a/src/partials/toc.html
+++ b/src/partials/toc.html
@@ -22,7 +22,7 @@
 
 <!-- Table of contents -->
 <nav class="md-nav md-nav--secondary">
-  {% set toc = page.toc %}
+  {% set toc_ = page.toc %}
 
   <!--
     This is a nasty hack that checks whether the content contains a h1
@@ -31,14 +31,14 @@
     anchor. Therefore we directly continue with the children of the anchor.
   -->
   {% if "\x3ch1 id=" in page.content %}
-    {% set toc = (toc | first).children %}
+    {% set toc_ = (toc_ | first).children %}
   {% endif %}
 
   <!-- Render item list -->
-  {% if toc and (toc | first) %}
+  {% if toc_ and (toc_ | first) %}
     <label class="md-nav__title" for="toc">Table of contents</label>
     <ul class="md-nav__list" data-md-scrollfix>
-      {% for toc_item in toc %}
+      {% for toc_item in toc_ %}
         {% include "partials/toc-item.html" %}
       {% endfor %}
     </ul>