diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index e97f6582..e4eb073c 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -1,6 +1,11 @@ {{- /* Read the config and format */ -}} {{- $params := .Page.Params | merge site.Params.page -}} -{{- $ordered := $params.toc.ordered | and $params.heading.number.enable -}} +{{- /* Toc data patch */ -}} +{{- $toc := $params.toc -}} +{{- if not (reflect.IsMap $toc) -}} + {{- $toc = dict "enable" $toc | merge site.Params.page.toc -}} +{{- end -}} +{{- $ordered := $toc.ordered | and $params.heading.number.enable -}} {{- $h1Format := $params.heading.number.format.h1 | default "{title}" -}} {{- $h2Format := $params.heading.number.format.h2 | default "{h2} {title}" -}} {{- $h3Format := $params.heading.number.format.h3 | default "{h2}.{h3} {title}" -}} diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 25acae05..9ef09dc9 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.13-53f221b7" -}} +{{- .Scratch.Set "version" "v0.3.13-9c440df3" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/layouts/partials/init/patch.html b/layouts/partials/init/patch.html index 9a987456..3a9e9933 100644 --- a/layouts/partials/init/patch.html +++ b/layouts/partials/init/patch.html @@ -3,10 +3,8 @@ {{- /* Toc data patch */ -}} {{- $toc := $params.toc -}} -{{- if eq $toc true -}} - {{- $toc = dict "enable" true | merge .Site.Params.page.toc -}} -{{- else if eq $toc false -}} - {{- $toc = dict "enable" false | merge .Site.Params.page.toc -}} +{{- if not (reflect.IsMap $toc) -}} + {{- $toc = dict "enable" $toc | merge .Site.Params.page.toc -}} {{- end -}} {{- .Scratch.Set "toc" $toc -}} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index d2d69c73..4297f111 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -7,7 +7,7 @@ {{- $title := cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- $params := partial "function/params.html" -}} {{- $toc := .Scratch.Get "toc" -}} - {{- $tableOfContents := .Fragments.ToHTML ($toc.startLevel | int) ($toc.endLevel | int) ($toc.ordered | default false) -}} + {{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) ($toc.ordered | default false) -}} {{- $showToc := $toc.enable | and (ne $tableOfContents ``) -}}