Skip to content

Commit

Permalink
toc: make omitting disableToc behave as the former default McShelby#133
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Nov 3, 2021
1 parent e95f7b1 commit 63dccef
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 6 deletions.
1 change: 0 additions & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ relativeURLs = true
author = "Sören Weber"
showVisitedLinks = true
disableBreadcrumb = false
disableToc = false
disableNextPrev = false
disableLandingPageButton = true
disableMermaid = false
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/basics/configuration/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/basics/history/_index.en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
+++
disableToc = false
title = "History"
weight = 30
+++
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/basics/history/_index.pir.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
+++
disableToc = false
title = "Historrry"
weight = 30
+++
Expand Down
9 changes: 8 additions & 1 deletion exampleSite/content/basics/migration/_index.en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
+++
disableToc = false
title = "What's new"
weight = 2
+++
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/basics/migration/_index.pir.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
+++
disableToc = false
title = "Migrrrat'n"
weight = 17
+++
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/content/cont/pages/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -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="">
Expand Down

0 comments on commit 63dccef

Please sign in to comment.