From 555dfae410e52276d724e96cd7578be65d4ec919 Mon Sep 17 00:00:00 2001 From: Patrick Marsceill <patrick.marsceill@gmail.com> Date: Sun, 16 Dec 2018 14:27:44 -0500 Subject: [PATCH] Make TOC on parent pages optional --- _layouts/default.html | 2 +- docs/navigation-structure.md | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index d6e61059..ae57564f 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -54,7 +54,7 @@ <div class="page-content"> {{ content }} - {% if page.has_children == true %} + {% if page.has_children == true and page.has_toc != false %} <hr> <h2 class="text-delta">Table of contents</h2> {% assign children_list = site.pages | sort:"nav_order" %} diff --git a/docs/navigation-structure.md b/docs/navigation-structure.md index cd9de438..647856db 100644 --- a/docs/navigation-structure.md +++ b/docs/navigation-structure.md @@ -92,7 +92,6 @@ On the parent pages, add 2 YAML front matter variables: #### Example {: .no_toc } - ```yaml --- layout: default @@ -121,6 +120,23 @@ nav_order: 2 --- ``` +### Auto-generating Table of Contents + +By default, all pages with children will automatically append a Table of Contents which lists the child pages after the parent page's content. To disable this auto Table of Contents, set it to false on the parent page's YAML front matter. + +#### Example +{: .no_toc } +```yaml +--- +layout: default +title: UI Components +nav_order: 2 +has_children: true +has_toc: false +permalink: /docs/ui-components +--- +``` + The Buttons page appears a child of UI Components and appears second in the UI Components section. ### Children with children -- GitLab