From 610d8c0e95c8e6868d60918fc30637cd45b75381 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 21 Feb 2016 18:19:25 +0100 Subject: [PATCH] Fixed #5: Page without headlines renders empty list in table of contents --- CHANGELOG | 1 + material/nav.html | 34 ++++++++++++++----------------- src/nav.html | 52 +++++++++++++++++++++-------------------------- 3 files changed, 39 insertions(+), 48 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d79a3f4cf..55f0a9e05 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ mkdocs-material-0.x.x (2016-xx-xx) * Fixed #3: Ordered lists within an unordered list have ::before content * Fixed #4: Click on Logo/Title without Github-Repository: "None" + * Fixed #5: Page without headlines renders empty list in table of contents * Moved Modernizr to top to ensure basic usability in IE8 mkdocs-material-0.1.2 (2016-02-16) diff --git a/material/nav.html b/material/nav.html index 9a7c43fae..4a8efd504 100644 --- a/material/nav.html +++ b/material/nav.html @@ -13,25 +13,21 @@ {{ nav_item.title }} {% if nav_item == current_page %} - + {% if h1 %} + {% set toc_item = toc | first %} + {% set toc = toc_item.children %} + {% endif %} + {% if toc %} + + {% endif %} {% endif %} {% endif %} \ No newline at end of file diff --git a/src/nav.html b/src/nav.html index 8d30f126e..69bf9d8d7 100644 --- a/src/nav.html +++ b/src/nav.html @@ -21,38 +21,32 @@ {% if nav_item == current_page %} - + {% endif %} {% endif %} {% endif %} \ No newline at end of file