diff --git a/material/partials/nav-item.html b/material/partials/nav-item.html
index f55ca979f..c1a24a1a0 100644
--- a/material/partials/nav-item.html
+++ b/material/partials/nav-item.html
@@ -40,10 +40,10 @@
{% set toc = page.toc %}
{% set first = toc | first %}
- {% if first is defined and first.level == 1 %}
+ {% if first and first.level == 1 %}
{% set toc = first.children %}
{% endif %}
- {% if toc is iterable %}
+ {% if toc %}
{{ nav_item.title }}
@@ -52,7 +52,7 @@
{{ nav_item.title }}
- {% if toc is iterable %}
+ {% if toc %}
{% include "partials/toc.html" %}
{% endif %}
diff --git a/material/partials/toc.html b/material/partials/toc.html
index 3415ad47c..f28c49f2b 100644
--- a/material/partials/toc.html
+++ b/material/partials/toc.html
@@ -5,10 +5,10 @@
{% set toc = page.toc %}
{% set first = toc | first %}
- {% if first is defined and first.level == 1 %}
+ {% if first and first.level == 1 %}
{% set toc = first.children %}
{% endif %}
- {% if toc is iterable %}
+ {% if toc %}
{{ lang.t("toc.title") }}
diff --git a/src/partials/nav-item.html b/src/partials/nav-item.html
index b68ee21c4..26a13d7b1 100644
--- a/src/partials/nav-item.html
+++ b/src/partials/nav-item.html
@@ -102,12 +102,12 @@
{% set first = toc | first %}
- {% if first is defined and first.level == 1 %}
+ {% if first and first.level == 1 %}
{% set toc = first.children %}
{% endif %}
- {% if toc is iterable %}
+ {% if toc %}
{{ nav_item.title }}
@@ -121,7 +121,7 @@
- {% if toc is iterable %}
+ {% if toc %}
{% include "partials/toc.html" %}
{% endif %}
diff --git a/src/partials/toc.html b/src/partials/toc.html
index 48afdcfa1..c4c6d7354 100644
--- a/src/partials/toc.html
+++ b/src/partials/toc.html
@@ -33,12 +33,12 @@
directly continue with the children of the anchor.
-->
{% set first = toc | first %}
- {% if first is defined and first.level == 1 %}
+ {% if first and first.level == 1 %}
{% set toc = first.children %}
{% endif %}
- {% if toc is iterable %}
+ {% if toc %}
{{ lang.t("toc.title") }}