diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 36516b32bb..46c128f33d 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -14,7 +14,6 @@ relativeURLs = true author = "Sören Weber" showVisitedLinks = true disableBreadcrumb = false - disableToc = false disableNextPrev = false disableLandingPageButton = true disableMermaid = false diff --git a/exampleSite/content/basics/configuration/_index.en.md b/exampleSite/content/basics/configuration/_index.en.md index e99907a730..dae1071057 100644 --- a/exampleSite/content/basics/configuration/_index.en.md +++ b/exampleSite/content/basics/configuration/_index.en.md @@ -47,8 +47,8 @@ Note that some of these parameters are explained in details in other sections of disableLanguageSwitchingButton = false # Hide breadcrumbs in the header and only show the current page title disableBreadcrumb = true - # Hide table of contens menu in the header of all pages - disableToc = true + # If set to true, hide table of contents menu in the header of all pages + disableToc = false # If set to true, prevents Hugo from including the Mermaid module if not needed (will reduce load times and traffic) disableMermaid = false # Specifies the remote location of the Mermaid js diff --git a/exampleSite/content/basics/history/_index.en.md b/exampleSite/content/basics/history/_index.en.md index d238f412b2..736b1192e6 100644 --- a/exampleSite/content/basics/history/_index.en.md +++ b/exampleSite/content/basics/history/_index.en.md @@ -1,4 +1,5 @@ +++ +disableToc = false title = "History" weight = 30 +++ diff --git a/exampleSite/content/basics/history/_index.pir.md b/exampleSite/content/basics/history/_index.pir.md index 844a9c1881..bbedda944c 100644 --- a/exampleSite/content/basics/history/_index.pir.md +++ b/exampleSite/content/basics/history/_index.pir.md @@ -1,4 +1,5 @@ +++ +disableToc = false title = "Historrry" weight = 30 +++ diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md index 12b6176957..589501ef93 100644 --- a/exampleSite/content/basics/migration/_index.en.md +++ b/exampleSite/content/basics/migration/_index.en.md @@ -1,4 +1,5 @@ +++ +disableToc = false title = "What's new" weight = 2 +++ @@ -16,11 +17,17 @@ This document shows you what's new in the latest release. For a detailed list of ## 2.8.0 - **New**: The theme now supports favicons served from `static/images/` named as `favicon` or `logo` in SVG, PNG or ICO format [out of the box]({{% relref "basics/customization/#change-the-favicon" %}}). An overridden partial `layouts/partials/favicon.html` may not be necessary anymore in most cases. -- **New**: Parameter "disableToc" in config.toml in section [params]. Now you can disable the TOC feature globally for all Pages if you don't want use it. + +- **New**: You can hide the table of contents menu for the whole site by setting the `disableToc` option in your `config.toml`. For an example see [the example configuration]({{%relref "basics/configuration/#global-site-parameters" %}}). + +--- ## 2.7.0 - **New**: Optional second parameter for [`notice`]({{% relref "shortcodes/notice" %}}) shortcode to set title in box header. + +--- + ## 2.6.0 - **New**: Your site can now be served from a subfolder if you set `baseURL` and `canonifyURLs=true` in your `config.toml`. See the [documentation]({{% relref "basics/configuration/#a-word-on-running-your-site-in-a-subfolder" %}}) for a detailed example. diff --git a/exampleSite/content/basics/migration/_index.pir.md b/exampleSite/content/basics/migration/_index.pir.md index 2b41b68f19..cfd18a2a5e 100644 --- a/exampleSite/content/basics/migration/_index.pir.md +++ b/exampleSite/content/basics/migration/_index.pir.md @@ -1,4 +1,5 @@ +++ +disableToc = false title = "Migrrrat'n" weight = 17 +++ diff --git a/exampleSite/content/cont/pages/_index.en.md b/exampleSite/content/cont/pages/_index.en.md index b1a161bc22..ef2e917c27 100644 --- a/exampleSite/content/cont/pages/_index.en.md +++ b/exampleSite/content/cont/pages/_index.en.md @@ -98,7 +98,7 @@ The Relearn theme uses the following parameters on top of Hugo ones : +++ # Table of contents (toc) is enabled by default. Set this parameter to true to disable it. # Note: Toc is always disabled for chapter pages -disableToc = "false" +disableToc = false # If set, this will be used for the page's menu entry (instead of the `title` attribute) menuTitle = "" # If set, this will explicitly override common rules for the expand state of a page's menu entry diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 6e90d138e0..7cf29302ff 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -55,7 +55,9 @@ {{- end }} {{- end }} - {{- $toc := (and (not .Params.disableToc) (not .Site.Params.disableToc) (not .Params.chapter)) }} + {{- $defaultDisableToc := .Site.Params.disableToc | default false }} + {{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }} + {{- $toc := (and (not $currentDisableToc) (not .Params.chapter)) }}