Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/apvarun/showcase-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun A P <varunlakshmananap@gmail.com>2021-06-18 21:26:45 +0300
committerVarun A P <varunlakshmananap@gmail.com>2021-06-18 21:26:45 +0300
commitfba49b08ff0f499277fa45eaf6660fb7d782d22e (patch)
tree630b0bead975762b8453dca703ec4eb66131bc90
parent6c03c85ee207d8747724e76e987e29f4e747fa31 (diff)
Exclude a specific section from auto-generated menu
-rw-r--r--README.md6
-rw-r--r--exampleSite/content/books/_index.md4
-rw-r--r--layouts/partials/header.html2
3 files changed, 11 insertions, 1 deletions
diff --git a/README.md b/README.md
index 14d8164..fdab5eb 100644
--- a/README.md
+++ b/README.md
@@ -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