diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 8db7191..a83b22c 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,8 +1,8 @@ {{- range $k, $v := (partialCached "init.html" .) -}} {{- $.Scratch.Set $k $v -}} {{- end -}} -{{ $commentEnable := .Params.comment.enable | default .Site.Params.comments.enable }} -{{ .Scratch.Set "isComment" $commentEnable }} +{{ $isComment := .Params.comment.enable | default .Site.Params.comments.enable }} +{{ .Scratch.Set "isComment" $isComment }} @@ -31,7 +31,7 @@
{{- block "main" . }}{{- end }} - {{- if and .IsPage $commentEnable }} + {{- if and .IsPage $isComment }} {{- partialCached "comments.html" . }} {{- end }}
diff --git a/layouts/partials/post/header.html b/layouts/partials/post/header.html index b482c8e..2097a4f 100644 --- a/layouts/partials/post/header.html +++ b/layouts/partials/post/header.html @@ -22,6 +22,7 @@ {{- end }} {{- end }} {{- if $.IsHome }} {{ else }} {{ end -}} +{{ $isComment := and (.Scratch.Get "isComment") .Site.Params.waline.comment }}
{{ partial "post/header_meta/created_date.html" . }} @@ -29,10 +30,10 @@ {{ partial "post/header_meta/categories.html" . }} {{ if and $.IsHome (not (isset .Params "extlink")) }} @@ -43,7 +44,7 @@ {{ partial "post/header_meta/words.html" . }} {{ partial "post/header_meta/readtime.html" . }} {{ partial "post/header_meta/views.html" . }} - {{ if and (.Scratch.Get "isComment") .Site.Params.waline.comment }} + {{ if $isComment }} {{ partial "post/header_meta/comments.html" . }} {{ end }}