toc: make omitting disableToc behave as the former default #133

This commit is contained in:
Sören Weber 2021-11-03 20:44:23 +01:00
parent e95f7b1a3e
commit 63dccef035
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
8 changed files with 17 additions and 6 deletions

View file

@ -14,7 +14,6 @@ relativeURLs = true
author = "Sören Weber" author = "Sören Weber"
showVisitedLinks = true showVisitedLinks = true
disableBreadcrumb = false disableBreadcrumb = false
disableToc = false
disableNextPrev = false disableNextPrev = false
disableLandingPageButton = true disableLandingPageButton = true
disableMermaid = false disableMermaid = false

View file

@ -47,8 +47,8 @@ Note that some of these parameters are explained in details in other sections of
disableLanguageSwitchingButton = false disableLanguageSwitchingButton = false
# Hide breadcrumbs in the header and only show the current page title # Hide breadcrumbs in the header and only show the current page title
disableBreadcrumb = true disableBreadcrumb = true
# Hide table of contens menu in the header of all pages # If set to true, hide table of contents menu in the header of all pages
disableToc = true disableToc = false
# If set to true, prevents Hugo from including the Mermaid module if not needed (will reduce load times and traffic) # If set to true, prevents Hugo from including the Mermaid module if not needed (will reduce load times and traffic)
disableMermaid = false disableMermaid = false
# Specifies the remote location of the Mermaid js # Specifies the remote location of the Mermaid js

View file

@ -1,4 +1,5 @@
+++ +++
disableToc = false
title = "History" title = "History"
weight = 30 weight = 30
+++ +++

View file

@ -1,4 +1,5 @@
+++ +++
disableToc = false
title = "Historrry" title = "Historrry"
weight = 30 weight = 30
+++ +++

View file

@ -1,4 +1,5 @@
+++ +++
disableToc = false
title = "What's new" title = "What's new"
weight = 2 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 ## 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**: 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 ## 2.7.0
- **New**: Optional second parameter for [`notice`]({{% relref "shortcodes/notice" %}}) shortcode to set title in box header. - **New**: Optional second parameter for [`notice`]({{% relref "shortcodes/notice" %}}) shortcode to set title in box header.
---
## 2.6.0 ## 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. - **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.

View file

@ -1,4 +1,5 @@
+++ +++
disableToc = false
title = "Migrrrat'n" title = "Migrrrat'n"
weight = 17 weight = 17
+++ +++

View file

@ -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. # Table of contents (toc) is enabled by default. Set this parameter to true to disable it.
# Note: Toc is always disabled for chapter pages # 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) # If set, this will be used for the page's menu entry (instead of the `title` attribute)
menuTitle = "" menuTitle = ""
# If set, this will explicitly override common rules for the expand state of a page's menu entry # If set, this will explicitly override common rules for the expand state of a page's menu entry

View file

@ -55,7 +55,9 @@
</div> </div>
{{- end }} {{- end }}
{{- 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)) }}
<div id="breadcrumbs"> <div id="breadcrumbs">
<span id="sidebar-toggle-span"> <span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle=""> <a href="#" id="sidebar-toggle" data-sidebar-toggle="">