💄 Update use waline pageview & add to homepage. Close #41, #42

This commit is contained in:
凡梦星尘
2022-10-29 18:15:39 +08:00
parent ac712b9277
commit 146bf52038
7 changed files with 51 additions and 4 deletions

View File

@@ -7,6 +7,14 @@
"title" .Page.Title
-}}
{{/* Append waline pageview plugin */}}
{{ if and .Site.Params.waline .Site.Params.waline.pageView }}
{{ $pageview := dict
"js" .Site.Data.resources.plugins.waline.js
}}
{{ $pageCfg = merge $pageCfg (dict "pageview" $pageview) }}
{{ end }}
{{/* Append mermaid plugin */}}
{{ if .Params.mermaid }}
{{ $mermaid := dict

View File

@@ -127,6 +127,11 @@
{{ $config = merge $config (dict "lawidget" $lawidget) }}
{{ end }}
{{ with .Site.Params.analytics.busuanzi }}
{{ $busz := dict "pageview" .postViews }}
{{ $config = merge $config (dict "busuanzi" $busz) }}
{{ end }}
{{ $globalVars.Set "config" $config }}
{{ with .Site.Params.customFilePath }}

View File

@@ -27,6 +27,9 @@
{{ partial "post/header_meta/created_date.html" . }}
{{ partial "post/header_meta/update_date.html" . }}
{{ partial "post/header_meta/categories.html" . }}
{{ if and $.IsHome (not (isset .Params "extlink")) }}
{{ partial "post/header_meta/views.html" . }}
{{ end }}
</div>
{{- if not $.IsHome }}
<div class="post-meta-items">

View File

@@ -2,9 +2,6 @@
{{- if .Site.Params.leancloudVisitors.enable }}
{{- $pageViewId = "leancloud-visitors-count" }}
{{- end }}
{{- if .Site.Params.waline.pageView }}
{{- $pageViewId = "waline-pageview-count" }}
{{- end }}
{{- if .Site.Params.analytics.busuanzi.postViews }}
{{- $pageViewId = "busuanzi_value_page_pv" }}
{{- end }}
@@ -15,5 +12,7 @@
<span class="post-meta-item-text">
{{ print (T "PostViews") (T "SymbolColon") }}
</span>
<span id="{{ $pageViewId }}" data-path="{{ .RelPermalink | relLangURL }}"><i class="fa fa-sync fa-spin"></i></span>
<span {{ with $pageViewId }}id="{{ . }}"{{end}} {{ with .Site.Params.waline.pageView }}class="waline-pageview-count"{{end}} data-path="{{ .RelPermalink | relLangURL }}">
<i class="fa fa-sync fa-spin"></i>
</span>
</span>

View File

@@ -49,6 +49,10 @@
{{ if isset .Site.Params "waline" }}
{{ $walinejs := resources.Get "js/third-party/comments/waline.js" }}
{{ $nextjs = $nextjs | append $walinejs }}
{{ if .Site.Params.waline.pageView }}
{{ $pageviewjs := resources.Get "js/third-party/others/pageview.js" }}
{{ $nextjs = $nextjs | append $pageviewjs }}
{{ end }}
{{ end }}
{{ if isset .Site.Params "giscus" }}
{{ $giscusjs := resources.Get "js/third-party/comments/giscus.js" }}