diff --git a/templates/index.html b/templates/index.html
index 98fdc8b..041abbe 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -63,8 +63,10 @@
{{page.title}}
- {% if current_path == page.path %}
-
+{% if page.toc %}
+
+{% if current_path == page.path %}
+
{% set_global header_count = 0 %}
{% for h2 in page.toc %}
{% set_global header_count = header_count + 1 %}
@@ -92,7 +94,7 @@
{% endif %}
-
+ {% endif %}
{% endif %}
{% endfor %}