fix: compatible with config.toml file without the autoCollapseToc parameter

This commit is contained in:
olOwOlo 2017-12-05 22:32:09 +08:00
parent c6a71c268b
commit 8c07810484
No known key found for this signature in database
GPG key ID: 456394B6E7A15EA6

View file

@ -1,8 +1,9 @@
{{ if and .Site.Params.toc (ne .Params.toc false) }}
<div class="post-toc" id="post-toc">
<h2 class="post-toc-title">{{ .Site.Data.even.default.posts.toc }}</h2>
<div class="post-toc-content{{ if or .Params.autoCollapseToc (and .Site.Params.autoCollapseToc (ne .Params.autoCollapseToc false)) | not }} always-active{{ end }}">
{{.TableOfContents}}
{{ $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
<div class="post-toc-content{{ if not (or .Params.autoCollapseToc (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false))) }} always-active{{ end }}">
{{.TableOfContents}}
</div>
</div>
{{- end }}