Improves ToC logic to account for both site and page configuration

This commit is contained in:
Philip Mallegol-Hansen 2024-05-01 13:58:51 -07:00
parent 7484d058f2
commit 8c4d7defca
No known key found for this signature in database

View File

@ -1,8 +1,12 @@
{{ $toc := true }}
{{ if isset .Site.Params "toc" }}
{{ $toc = .Site.Params.toc }}
{{ if isset .Params "toc" }}
{{ $toc = .Params.toc }}
{{ else }}
{{ $toc = ge .WordCount .Site.Params.tocWordCount }}
{{ if and (isset .Site.Params "toc") (not (.Site.Params.toc)) }}
{{ $toc = false }}
{{ end }}
{{ end }}
{{ $toc = and ($toc) (ge .WordCount .Site.Params.tocWordCount) }}
{{ if $toc }}