🐛 Fixed the page views counter in home page.

This commit is contained in:
凡梦星尘 2022-11-06 18:23:55 +08:00
parent dd3766bce3
commit 8918bff71f
2 changed files with 7 additions and 6 deletions

View File

@ -1,8 +1,8 @@
{{- range $k, $v := (partialCached "init.html" .) -}} {{- range $k, $v := (partialCached "init.html" .) -}}
{{- $.Scratch.Set $k $v -}} {{- $.Scratch.Set $k $v -}}
{{- end -}} {{- end -}}
{{ $commentEnable := .Params.comment.enable | default .Site.Params.comments.enable }} {{ $isComment := .Params.comment.enable | default .Site.Params.comments.enable }}
{{ .Scratch.Set "isComment" $commentEnable }} {{ .Scratch.Set "isComment" $isComment }}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}" data-theme="{{ .Scratch.Get "theme" }}"> <html lang="{{ .Site.LanguageCode }}" data-theme="{{ .Scratch.Get "theme" }}">
@ -31,7 +31,7 @@
<div class="main-inner {{ block "main_inner_class" . }}{{ end }}"> <div class="main-inner {{ block "main_inner_class" . }}{{ end }}">
<!-- Submenu,Content,Comment --> <!-- Submenu,Content,Comment -->
{{- block "main" . }}{{- end }} {{- block "main" . }}{{- end }}
{{- if and .IsPage $commentEnable }} {{- if and .IsPage $isComment }}
{{- partialCached "comments.html" . }} {{- partialCached "comments.html" . }}
{{- end }} {{- end }}
</div> </div>

View File

@ -22,6 +22,7 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if $.IsHome }} </h2> {{ else }} </h1> {{ end -}} {{- if $.IsHome }} </h2> {{ else }} </h1> {{ end -}}
{{ $isComment := and (.Scratch.Get "isComment") .Site.Params.waline.comment }}
<div class="post-meta-container"> <div class="post-meta-container">
<div class="post-meta-items"> <div class="post-meta-items">
{{ partial "post/header_meta/created_date.html" . }} {{ partial "post/header_meta/created_date.html" . }}
@ -29,10 +30,10 @@
{{ partial "post/header_meta/categories.html" . }} {{ partial "post/header_meta/categories.html" . }}
{{ if and $.IsHome (not (isset .Params "extlink")) }} {{ if and $.IsHome (not (isset .Params "extlink")) }}
<div class="post-meta-items"> <div class="post-meta-items">
{{ if and (eq .Site.Params.analytis.busuanzi.enable false) .Site.Params.waline.pageView }} {{ if .Site.Params.waline.pageView }}
{{ partial "post/header_meta/views.html" . }} {{ partial "post/header_meta/views.html" . }}
{{ end }} {{ end }}
{{ if and (.Scratch.Get "isComment") .Site.Params.waline.comment }} {{ if $isComment }}
{{ partial "post/header_meta/comments.html" . }} {{ partial "post/header_meta/comments.html" . }}
{{ end }} {{ end }}
</div> </div>
@ -43,7 +44,7 @@
{{ partial "post/header_meta/words.html" . }} {{ partial "post/header_meta/words.html" . }}
{{ partial "post/header_meta/readtime.html" . }} {{ partial "post/header_meta/readtime.html" . }}
{{ partial "post/header_meta/views.html" . }} {{ partial "post/header_meta/views.html" . }}
{{ if and (.Scratch.Get "isComment") .Site.Params.waline.comment }} {{ if $isComment }}
{{ partial "post/header_meta/comments.html" . }} {{ partial "post/header_meta/comments.html" . }}
{{ end }} {{ end }}
</div> </div>