Improves ToC logic to account for both site and page configuration
This commit is contained in:
parent
7484d058f2
commit
8c4d7defca
1 changed files with 7 additions and 3 deletions
|
@ -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 }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue