From ca0de52b45684251525d11ae07c450e12c838954 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Fri, 30 Dec 2016 21:11:05 +0100 Subject: [PATCH] Fix rendering of empty pane in mobile navigation when no headlines are given --- material/partials/nav-item.html | 16 ++++++++++++---- src/partials/nav-item.html | 18 ++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) 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 %}