diff options
author | Varun A P <varunlakshmananap@gmail.com> | 2021-06-18 21:26:45 +0300 |
---|---|---|
committer | Varun A P <varunlakshmananap@gmail.com> | 2021-06-18 21:26:45 +0300 |
commit | fba49b08ff0f499277fa45eaf6660fb7d782d22e (patch) | |
tree | 630b0bead975762b8453dca703ec4eb66131bc90 | |
parent | 6c03c85ee207d8747724e76e987e29f4e747fa31 (diff) |
Exclude a specific section from auto-generated menu
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | exampleSite/content/books/_index.md | 4 | ||||
-rw-r--r-- | layouts/partials/header.html | 2 |
3 files changed, 11 insertions, 1 deletions
@@ -64,6 +64,12 @@ From `exampleSite/`, copy `config.toml` to the root folder of your Hugo site and Menu in Showcase theme is auto-generated from the sections inside your content folder. +### Exclude Sections from Menu + +It is possible to exclude sections from the auto-generated list. In order to exclude a section, create an `_index.md` file in that section and set the property `private` to `true`. Refer example [index file](https://github.com/apvarun/showcase-hugo-theme/blob/master/exampleSite/content/books/_index.md). + +### Custom Menu + You can also add a custom menu item using the `config.toml` and disable auto-generated sections if not required. Refer config in [exampleSite](https://github.com/apvarun/showcase-hugo-theme/blob/master/exampleSite/config.toml) ## Google Analytics diff --git a/exampleSite/content/books/_index.md b/exampleSite/content/books/_index.md new file mode 100644 index 0000000..9195d97 --- /dev/null +++ b/exampleSite/content/books/_index.md @@ -0,0 +1,4 @@ +--- +title: Books +private: true +--- diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 3c603d3..ed022a9 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -16,7 +16,7 @@ class="mr-2 px-2 rounded cursor-pointer select-none hover:text-gray-900 show-all" >All</a > - {{ range .Site.Sections }} + {{ range where .Site.Sections ".Params.private" "!=" true }} <a class="mr-2 px-2 rounded cursor-pointer select-none hover:text-gray-900 filter-{{lower .Title}}" >{{.Title}}</a |