From 5ec874d64e1fe31278acde1b1444b26620a0fbc8 Mon Sep 17 00:00:00 2001 From: alicewish Date: Wed, 20 Dec 2017 21:33:05 +0800 Subject: [PATCH] feat: add LiveRe and busuanzi (#17) * LiveRe: commenting system * busuanzi: count web traffic --- data/even/default.toml | 5 +++ data/even/en.toml | 5 +++ data/even/zh-CN.toml | 5 +++ exampleSite/config.toml | 7 +++++ exampleSite/data/even/default.toml | 5 +++ layouts/partials/comments.html | 39 ++++++++++++++++++------ layouts/partials/footer.html | 20 ++++++++++-- layouts/partials/head.html | 5 +++ layouts/post/single.html | 4 +++ static/img/spinner.svg | 49 ++++++++++++++++++++++++++++++ 10 files changed, 132 insertions(+), 12 deletions(-) create mode 100644 static/img/spinner.svg diff --git a/data/even/default.toml b/data/even/default.toml index ebbb7b6..e87bd7c 100644 --- a/data/even/default.toml +++ b/data/even/default.toml @@ -40,3 +40,8 @@ categories = "分类" [counter.categories] zero = "暂无分类" other = "共计 %d 个分类" + +[traffic] + siteUV = "本站总访客数 %s 人" + sitePV = "本站总访问量 %s 次" + pagePV = "%s 次阅读" diff --git a/data/even/en.toml b/data/even/en.toml index 742649e..09cb578 100644 --- a/data/even/en.toml +++ b/data/even/en.toml @@ -40,3 +40,8 @@ categories = "Categories" [counter.categories] zero = "No Categories" other = "%d Categories In Total" + +[traffic] + siteUV = "site uv: %s" + sitePV = "site pv: %s" + pagePV = "%s times read" diff --git a/data/even/zh-CN.toml b/data/even/zh-CN.toml index ebbb7b6..e87bd7c 100644 --- a/data/even/zh-CN.toml +++ b/data/even/zh-CN.toml @@ -40,3 +40,8 @@ categories = "分类" [counter.categories] zero = "暂无分类" other = "共计 %d 个分类" + +[traffic] + siteUV = "本站总访客数 %s 人" + sitePV = "本站总访问量 %s 次" + pagePV = "%s 次阅读" diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 373a33c..e2ed85c 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -73,6 +73,7 @@ copyright = "" # default: author.name ↓ # 默认为下面配 changyanAppid = "" # Changyan app id # 畅言 changyanAppkey = "" # Changyan app key + livereUID = "" # LiveRe UID # 来必力 baidu_push = false # baidu push # 百度 baidu_analytics = "" # Baidu Analytics baidu_verification = "" # Baidu Verification @@ -85,6 +86,12 @@ copyright = "" # default: author.name ↓ # 默认为下面配 fancyboxJs = '' fancyboxCss = '' + [params.busuanzi] # count web traffic by busuanzi # 是否使用不蒜子统计站点访问量 + enable = false + siteUV = true + sitePV = true + pagePV = true + [params.reward] # 文章打赏 enable = false wechat = "/path/to/your/wechat-qr-code.png" # 微信二维码 diff --git a/exampleSite/data/even/default.toml b/exampleSite/data/even/default.toml index 742649e..09cb578 100644 --- a/exampleSite/data/even/default.toml +++ b/exampleSite/data/even/default.toml @@ -40,3 +40,8 @@ categories = "Categories" [counter.categories] zero = "No Categories" other = "%d Categories In Total" + +[traffic] + siteUV = "site uv: %s" + sitePV = "site pv: %s" + pagePV = "%s times read" diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 8728c17..afce2a3 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -4,24 +4,23 @@
- comments powered by Disqus {{- end }} {{- if and .Site.Params.changyanAppid .Site.Params.changyanAppkey -}} -
- {{- end }} + + + {{- if .Site.Params.livereUID -}} +
+ + +
+ {{- end }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 7ce1aaf..50ddeb4 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,3 +1,4 @@ +{{ $lang := .Site.Data.even.default -}}