From 7c67b90acf041a02d652cc5cc893b69f3877b0cf Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sun, 28 Jul 2024 13:34:53 +0800 Subject: [PATCH] :recycle: Refactor: deprecate params.ibruce in favor of params.busuanzi powered by Vercount Resolve #472 Close EvanNotFound/vercount#10 --- README.md | 1 + README.zh-cn.md | 1 + hugo.toml | 13 ++++-- layouts/partials/assets.html | 12 +++-- layouts/partials/footer.html | 13 ++++-- .../partials/init/detection-deprecated.html | 4 ++ layouts/posts/single.html | 45 +++++++++---------- 7 files changed, 54 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 14f2855e..fce8a04a 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,7 @@ Thanks to all the [contributors](https://github.com/hugo-fixit/FixIt/graphs/cont - [cookieconsent](https://github.com/osano/cookieconsent) - [cell-watermark](https://github.com/Lruihao/watermark) - [不蒜子](http://busuanzi.ibruce.info/) +- [Vercount](https://github.com/EvanNotFound/vercount) - [pangu.js](https://github.com/vinta/pangu.js) - [Artalk](https://artalk.js.org/) - [Waline](https://waline.js.org/) diff --git a/README.zh-cn.md b/README.zh-cn.md index 3448b85b..b7ed85f7 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -192,6 +192,7 @@ FixIt 支持下列语言: - [cookieconsent](https://github.com/osano/cookieconsent) - [cell-watermark](https://github.com/Lruihao/watermark) - [不蒜子](http://busuanzi.ibruce.info/) +- [Vercount](https://github.com/EvanNotFound/vercount) - [pangu.js](https://github.com/vinta/pangu.js) - [Artalk](https://artalk.js.org/) - [Waline](https://waline.js.org/) diff --git a/hugo.toml b/hugo.toml index c48603b7..f0c67a2d 100644 --- a/hugo.toml +++ b/hugo.toml @@ -693,11 +693,16 @@ enableEmoji = true # FixIt 0.2.13 | NEW watermark's fontFamily fontFamily = "inherit" - # FixIt 0.2.12 | NEW Busuanzi count - [params.ibruce] + # FixIt 0.3.10 | NEW Busuanzi count + [params.busuanzi] + # whether to enable busuanzi count enable = false - # Enable in post meta - enablePost = false + # busuanzi count core ["vercount", "busuanzi"], default: "vercount" + core = "vercount" + # whether to show the site views + siteViews = true + # whether to show the page views + pageViews = true # Site verification code config for Google/Bing/Yandex/Pinterest/Baidu/360/Sogou [params.verification] diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index 6074f28f..aa63bd87 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -210,9 +210,15 @@ {{- end -}} {{- /* 不蒜子 */ -}} -{{- if eq .Site.Params.ibruce.enable true -}} - {{- $source := "//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} +{{- if eq .Site.Params.busuanzi.enable true -}} + {{- $source := "https://vercount.one/js" -}} + {{- if eq .Lang "zh-cn" -}} + {{- $source = "https://cn.vercount.one/js" -}} + {{- end -}} + {{- if eq .Site.Params.busuanzi.core "busuanzi" -}} + {{- $source = "//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" -}} + {{- end -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- /* Site creation time */ -}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 1c9e13dc..1d9f4f4b 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -70,15 +70,20 @@ {{- end -}} {{- /* 不蒜子 */ -}} - {{- if eq .Site.Params.ibruce.enable true -}} + {{- $busuanzi := .Site.Params.busuanzi -}} + {{- if eq $busuanzi.enable true -}} {{- $loading := dict "Class" "fa-solid fa-spinner fa-spin fa-fw" | partial "plugin/icon.html" -}} -