parent
ac712b9277
commit
146bf52038
21
assets/js/third-party/others/pageview.js
vendored
Normal file
21
assets/js/third-party/others/pageview.js
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* Waline pageview plugin */
|
||||||
|
NexT.plugins.others.pageview = function() {
|
||||||
|
const busz = NexT.CONFIG.busuanzi;
|
||||||
|
if (busz != undefined && busz.pageview) return;
|
||||||
|
|
||||||
|
let pageview_js = undefined;
|
||||||
|
|
||||||
|
// Here can append others pageview plugin
|
||||||
|
const waline = NexT.CONFIG.waline;
|
||||||
|
if (waline != undefined && waline.cfg.pageview) {
|
||||||
|
pageview_js = NexT.utils.getCDNResource(NexT.CONFIG.page.pageview.js);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageview_js == undefined) return;
|
||||||
|
|
||||||
|
NexT.utils.getScript(pageview_js, function(){
|
||||||
|
Waline.pageviewCount({
|
||||||
|
serverURL: waline.cfg.serverurl
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -109,5 +109,12 @@ plugins:
|
|||||||
name: mermaid
|
name: mermaid
|
||||||
version: 9.1.7
|
version: 9.1.7
|
||||||
file: dist/mermaid.min.js
|
file: dist/mermaid.min.js
|
||||||
|
# 文章访问统计
|
||||||
|
waline:
|
||||||
|
js:
|
||||||
|
name: '@waline/client'
|
||||||
|
version: 2.11.3
|
||||||
|
file: dist/pageview.js
|
||||||
|
alias: waline
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,14 @@
|
|||||||
"title" .Page.Title
|
"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 */}}
|
{{/* Append mermaid plugin */}}
|
||||||
{{ if .Params.mermaid }}
|
{{ if .Params.mermaid }}
|
||||||
{{ $mermaid := dict
|
{{ $mermaid := dict
|
||||||
|
@ -127,6 +127,11 @@
|
|||||||
{{ $config = merge $config (dict "lawidget" $lawidget) }}
|
{{ $config = merge $config (dict "lawidget" $lawidget) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with .Site.Params.analytics.busuanzi }}
|
||||||
|
{{ $busz := dict "pageview" .postViews }}
|
||||||
|
{{ $config = merge $config (dict "busuanzi" $busz) }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ $globalVars.Set "config" $config }}
|
{{ $globalVars.Set "config" $config }}
|
||||||
|
|
||||||
{{ with .Site.Params.customFilePath }}
|
{{ with .Site.Params.customFilePath }}
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
{{ partial "post/header_meta/created_date.html" . }}
|
{{ partial "post/header_meta/created_date.html" . }}
|
||||||
{{ partial "post/header_meta/update_date.html" . }}
|
{{ partial "post/header_meta/update_date.html" . }}
|
||||||
{{ partial "post/header_meta/categories.html" . }}
|
{{ partial "post/header_meta/categories.html" . }}
|
||||||
|
{{ if and $.IsHome (not (isset .Params "extlink")) }}
|
||||||
|
{{ partial "post/header_meta/views.html" . }}
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{- if not $.IsHome }}
|
{{- if not $.IsHome }}
|
||||||
<div class="post-meta-items">
|
<div class="post-meta-items">
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
{{- if .Site.Params.leancloudVisitors.enable }}
|
{{- if .Site.Params.leancloudVisitors.enable }}
|
||||||
{{- $pageViewId = "leancloud-visitors-count" }}
|
{{- $pageViewId = "leancloud-visitors-count" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Site.Params.waline.pageView }}
|
|
||||||
{{- $pageViewId = "waline-pageview-count" }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Site.Params.analytics.busuanzi.postViews }}
|
{{- if .Site.Params.analytics.busuanzi.postViews }}
|
||||||
{{- $pageViewId = "busuanzi_value_page_pv" }}
|
{{- $pageViewId = "busuanzi_value_page_pv" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@ -15,5 +12,7 @@
|
|||||||
<span class="post-meta-item-text">
|
<span class="post-meta-item-text">
|
||||||
{{ print (T "PostViews") (T "SymbolColon") }}
|
{{ print (T "PostViews") (T "SymbolColon") }}
|
||||||
</span>
|
</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>
|
</span>
|
||||||
|
@ -49,6 +49,10 @@
|
|||||||
{{ if isset .Site.Params "waline" }}
|
{{ if isset .Site.Params "waline" }}
|
||||||
{{ $walinejs := resources.Get "js/third-party/comments/waline.js" }}
|
{{ $walinejs := resources.Get "js/third-party/comments/waline.js" }}
|
||||||
{{ $nextjs = $nextjs | append $walinejs }}
|
{{ $nextjs = $nextjs | append $walinejs }}
|
||||||
|
{{ if .Site.Params.waline.pageView }}
|
||||||
|
{{ $pageviewjs := resources.Get "js/third-party/others/pageview.js" }}
|
||||||
|
{{ $nextjs = $nextjs | append $pageviewjs }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if isset .Site.Params "giscus" }}
|
{{ if isset .Site.Params "giscus" }}
|
||||||
{{ $giscusjs := resources.Get "js/third-party/comments/giscus.js" }}
|
{{ $giscusjs := resources.Get "js/third-party/comments/giscus.js" }}
|
||||||
|
Loading…
Reference in New Issue
Block a user