From 9cb8a28305219107f4fc1a641fe9323433f37e24 Mon Sep 17 00:00:00 2001 From: Aimee Ukasick Date: Mon, 2 Aug 2021 13:44:43 -0500 Subject: [PATCH 1/4] Navigation: omit hidden pages from section index page list Fix: https://github.com/google/docsy/issues/647 Update section-index.html to exclude pages with front matter `toc_hide: true`. Pages hidden from TOC should not appear in a section index's list of pages. --- layouts/partials/section-index.html | 1 + userguide/content/en/docs/Adding content/navigation.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/partials/section-index.html b/layouts/partials/section-index.html index 665f301846..8d4dd1b2f6 100644 --- a/layouts/partials/section-index.html +++ b/layouts/partials/section-index.html @@ -2,6 +2,7 @@ {{ $parent := .Page }} {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }} {{ $pages = (where $pages "Type" "!=" "search") }} + {{ $pages = (where $pages ".Params.toc_hide" "!=" true) }} {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }} {{ if or $parent.Params.no_list (eq (len $pages) 0) }} {{/* If no_list is true or we don't have subpages we don't show a list of subpages */}} diff --git a/userguide/content/en/docs/Adding content/navigation.md b/userguide/content/en/docs/Adding content/navigation.md index 63c672fef8..7068ca0e9f 100644 --- a/userguide/content/en/docs/Adding content/navigation.md +++ b/userguide/content/en/docs/Adding content/navigation.md @@ -78,7 +78,7 @@ description: > --- ``` -To hide a page or section from the menu, set `toc_hide: true` in front matter. +To hide a page or section from the menu, set `toc_hide: true` in front matter. When set to true in a page, that page is not displayed in the section index page's list of pages. ### Section menu options From a4fb0d7e9159f62afe541e91001aa61f609b7a5d Mon Sep 17 00:00:00 2001 From: Aimee Ukasick Date: Tue, 3 Aug 2021 10:56:26 -0500 Subject: [PATCH 2/4] Create hide_summary front matter and exclude if true section-index: exclude page if hide_summary: true --- layouts/partials/section-index.html | 2 +- .../content/en/docs/Adding content/navigation.md | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/layouts/partials/section-index.html b/layouts/partials/section-index.html index 8d4dd1b2f6..dd4876973a 100644 --- a/layouts/partials/section-index.html +++ b/layouts/partials/section-index.html @@ -2,7 +2,7 @@ {{ $parent := .Page }} {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }} {{ $pages = (where $pages "Type" "!=" "search") }} - {{ $pages = (where $pages ".Params.toc_hide" "!=" true) }} + {{ $pages = (where $pages ".Params.hide_summary" "!=" true) }} {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }} {{ if or $parent.Params.no_list (eq (len $pages) 0) }} {{/* If no_list is true or we don't have subpages we don't show a list of subpages */}} diff --git a/userguide/content/en/docs/Adding content/navigation.md b/userguide/content/en/docs/Adding content/navigation.md index 7068ca0e9f..c6db7f2f2d 100644 --- a/userguide/content/en/docs/Adding content/navigation.md +++ b/userguide/content/en/docs/Adding content/navigation.md @@ -78,7 +78,20 @@ description: > --- ``` -To hide a page or section from the menu, set `toc_hide: true` in front matter. When set to true in a page, that page is not displayed in the section index page's list of pages. +To hide a page or section from the menu, set `toc_hide: true` in the front matter. + +To hide a page on the section summary, set `hide_summary: true` in the front matter. If you want to hide a page from both the TOC menu and the section summary list, you need to set both `toc_hide` and `hide_summery` to `true` in the front matter. + +```yaml +--- +title: "My Hidden Page" +weight: 99 +toc_hide: true +hide_summary: true +description: > + Page hidden from both the TOC menu and the section summary list. +--- +``` ### Section menu options From 183e32e16f3216212c22b18522eb4aedd1ca9787 Mon Sep 17 00:00:00 2001 From: Aimee Ukasick Date: Mon, 16 Aug 2021 11:14:51 -0500 Subject: [PATCH 3/4] address review feedback; fix typo --- userguide/content/en/docs/Adding content/navigation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userguide/content/en/docs/Adding content/navigation.md b/userguide/content/en/docs/Adding content/navigation.md index c6db7f2f2d..40e15ce4b6 100644 --- a/userguide/content/en/docs/Adding content/navigation.md +++ b/userguide/content/en/docs/Adding content/navigation.md @@ -80,7 +80,7 @@ description: > To hide a page or section from the menu, set `toc_hide: true` in the front matter. -To hide a page on the section summary, set `hide_summary: true` in the front matter. If you want to hide a page from both the TOC menu and the section summary list, you need to set both `toc_hide` and `hide_summery` to `true` in the front matter. +To hide a page from the section summary on a [docs section landing page]({{< ref "content#docs-section-landing-pages" >}}), set `hide_summary: true` in the front matter. If you want to hide a page from both the TOC menu and the section summary list, you need to set both `toc_hide` and `hide_summary` to `true` in the front matter. ```yaml --- From 6b18fc833513aaf804ef9547aa5e9411fad87c59 Mon Sep 17 00:00:00 2001 From: Aimee Ukasick Date: Mon, 16 Aug 2021 11:17:47 -0500 Subject: [PATCH 4/4] fix typo (and save the file!) --- userguide/content/en/docs/Adding content/navigation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userguide/content/en/docs/Adding content/navigation.md b/userguide/content/en/docs/Adding content/navigation.md index 40e15ce4b6..3e052aad82 100644 --- a/userguide/content/en/docs/Adding content/navigation.md +++ b/userguide/content/en/docs/Adding content/navigation.md @@ -78,7 +78,7 @@ description: > --- ``` -To hide a page or section from the menu, set `toc_hide: true` in the front matter. +To hide a page or section from the left navigation menu, set `toc_hide: true` in the front matter. To hide a page from the section summary on a [docs section landing page]({{< ref "content#docs-section-landing-pages" >}}), set `hide_summary: true` in the front matter. If you want to hide a page from both the TOC menu and the section summary list, you need to set both `toc_hide` and `hide_summary` to `true` in the front matter.