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"
showVisitedLinks = true
disableBreadcrumb = false
disableToc = false
disableNextPrev = false
disableLandingPageButton = true
disableMermaid = false

View file

@ -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

View file

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

View file

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

View file

@ -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.

View file

@ -1,4 +1,5 @@
+++
disableToc = false
title = "Migrrrat'n"
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.
# 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

View file

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