diff --git a/material/partials/nav-item.html b/material/partials/nav-item.html index 10d9fdefa..9453d04a7 100644 --- a/material/partials/nav-item.html +++ b/material/partials/nav-item.html @@ -24,14 +24,22 @@ {% elif nav_item == page %}
  • + {% set toc = page.toc %} - + {% if "\x3ch1 id=" in page.content %} + {% set toc = (toc | first).children %} + {% endif %} + {% if toc and (toc | first) %} + + {% endif %} {{ nav_item.title }} - {% include "partials/toc.html" %} + {% if page.toc %} + {% include "partials/toc.html" %} + {% endif %}
  • {% else %}
  • diff --git a/src/partials/nav-item.html b/src/partials/nav-item.html index 8836d827f..3ab2da9e0 100644 --- a/src/partials/nav-item.html +++ b/src/partials/nav-item.html @@ -57,22 +57,32 @@ {% elif nav_item == page %}
  • + {% set toc = page.toc %} + + {% if "\x3ch1 id=" in page.content %} + {% set toc = (toc | first).children %} + {% endif %} + - + {% if toc and (toc | first) %} + + {% endif %} {{ nav_item.title }} - {% include "partials/toc.html" %} + {% if page.toc %} + {% include "partials/toc.html" %} + {% endif %}