2023-09-18 18:24:49 +00:00
|
|
|
{{- $onempty := cond (isset . "onempty") .onempty "hide" }}
|
|
|
|
{{- $onwidths := cond (isset . "onwidths") .onwidths "show" }}
|
|
|
|
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
|
|
|
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
|
|
|
{{- with .page }}
|
|
|
|
{{- $format := partial "get-format.hugo" . }}
|
|
|
|
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
|
|
|
{{- $defaultDisableToc := .Site.Params.disableToc | default false }}
|
|
|
|
{{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }}
|
|
|
|
{{- if and (eq $outputFormat "html") (not $currentDisableToc) }}
|
|
|
|
{{- $content := partial "toc-class.html" . }}
|
2024-04-27 12:38:19 +00:00
|
|
|
{{- $hascontent := not (eq 0 (int (len ($content | plainify | chomp)))) }}
|
2023-09-18 18:24:49 +00:00
|
|
|
{{- if not $hascontent }}
|
|
|
|
{{- $content = " " }}
|
|
|
|
{{- end }}
|
|
|
|
{{- partial "topbar/func/button.html" (dict
|
|
|
|
"page" .
|
|
|
|
"class" "topbar-button-toc"
|
|
|
|
"href" "javascript:toggleTopbarFlyout(this)"
|
|
|
|
"icon" "list-alt"
|
|
|
|
"onempty" $onempty
|
|
|
|
"onwidths" $onwidths
|
|
|
|
"onwidthm" $onwidthm
|
|
|
|
"onwidthl" $onwidthl
|
2023-12-05 07:40:58 +00:00
|
|
|
"hint" (printf "%s (CTRL+ALT+t)" (T "Toc-toggle"))
|
2023-09-18 18:24:49 +00:00
|
|
|
"content" $content
|
|
|
|
)}}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|