You've already forked no-js-hugo-theme
Rename the table of contents settings
- font matter: tableofcontents -> toc - config: tableOfContentsWordCount -> tocWordThreshold
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ if or (.Params.tableofcontents) (and (ne .Params.tableofcontents false) (isset .Site.Params "tableofcontentswordcount") (ge .Site.Params.TableOfContentsWordCount 0) (gt .WordCount .Site.Params.TableOfContentsWordCount)) }}
|
{{ if or (.Params.toc) (and (ne .Params.toc false) (isset .Site.Params "tocwordthreshold") (ge .Site.Params.TocWordThreshold 0) (gt .WordCount .Site.Params.TocWordThreshold)) }}
|
||||||
{{/* If the front matter parameter is true, show the toc */}}
|
{{/* If the front matter parameter is true, show the toc */}}
|
||||||
{{/* Elif the front matter parameter is false, don't show the toc */}}
|
{{/* Elif the front matter parameter is false, don't show the toc */}}
|
||||||
{{/* Elif the front matter parameter is not set, show the toc if the site parameter is set, non-negative, and less than the word count */}}
|
{{/* Elif the front matter parameter is not set, show the toc if the site parameter is set, non-negative, and less than the word count */}}
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
<span class="table-of-contents-title">Table of Contents</span>
|
<span class="table-of-contents-title">Table of Contents</span>
|
||||||
</summary>
|
</summary>
|
||||||
{{ $toc := .TableOfContents -}}
|
{{ $toc := .TableOfContents -}}
|
||||||
|
{{/* Workaround for an extra layer of indentation (https://discourse.gohugo.io/t/2303) */}}
|
||||||
{{- $toc := replaceRE `<nav(.*)>(\s?)<ul>\s?<li>\s?<ul>` `<nav${1}>${2}<ul>` $toc -}}
|
{{- $toc := replaceRE `<nav(.*)>(\s?)<ul>\s?<li>\s?<ul>` `<nav${1}>${2}<ul>` $toc -}}
|
||||||
{{- $toc := replaceRE `</ul>\s?</li>\s?</ul>(\s?)</nav>` `</ul>${1}</nav>` $toc -}}
|
{{- $toc := replaceRE `</ul>\s?</li>\s?</ul>(\s?)</nav>` `</ul>${1}</nav>` $toc -}}
|
||||||
{{- safeHTML $toc }}
|
{{- safeHTML $toc }}
|
||||||
|
Reference in New Issue
Block a user