From d80f3e4f27fd81c2bdc9c2040eb14ce1bcf0241b Mon Sep 17 00:00:00 2001 From: ppoffice Date: Sat, 2 Feb 2019 12:21:30 -0500 Subject: [PATCH] chore(*): improve busuanzi counter & add mathjax inline math config --- includes/specs/plugins.spec.js | 4 ++-- languages/en.yml | 2 ++ languages/zh-CN.yml | 2 ++ layout/common/article.ejs | 17 ++++++----------- layout/common/footer.ejs | 16 ++++++---------- layout/plugin/{visit.ejs => busuanzi.ejs} | 0 layout/plugin/mathjax.ejs | 18 +++++++++++++++--- 7 files changed, 33 insertions(+), 26 deletions(-) rename layout/plugin/{visit.ejs => busuanzi.ejs} (100%) diff --git a/includes/specs/plugins.spec.js b/includes/specs/plugins.spec.js index 2b13c0f..0ee616e 100644 --- a/includes/specs/plugins.spec.js +++ b/includes/specs/plugins.spec.js @@ -65,9 +65,9 @@ module.exports = { [doc]: 'Show the copy button in the highlighted code area', [defaultValue]: true }, - visit: { + busuanzi: { [type]: 'boolean', - [doc]: 'Show PV/UV of blog and PV of each article', + [doc]: 'BuSuanZi site/page view counter\nhttps://busuanzi.ibruce.info', [defaultValue]: false } }; \ No newline at end of file diff --git a/languages/en.yml b/languages/en.yml index 816fe2c..2e064eb 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -33,6 +33,8 @@ donate: patreon: 'Patreon' plugin: backtotop: 'Back to Top' + visit: '%s visits' + visitor: 'Visited by %s users' search: search: 'Search' hint: 'Type something...' diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 5ca1fc7..7c0846c 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -31,6 +31,8 @@ donate: wechat: '微信' plugin: backtotop: '回到顶端' + visit: '%s次访问' + visitor: '共%s个访客' search: search: '搜索' hint: '想要查找什么...' diff --git a/layout/common/article.ejs b/layout/common/article.ejs index 7eadebb..25bb997 100644 --- a/layout/common/article.ejs +++ b/layout/common/article.ejs @@ -28,6 +28,12 @@ <%= `${ time.locale(get_config('language', 'en')).humanize() } ${ __('article.read')} (${ __('article.about') } ${ words } ${ __('article.words') })` %> <% } %> + <% if (!index && (has_config('plugins.busuanzi') ? get_config('plugins.busuanzi') : false)) { %> + + + <%- _p('plugin.visit', '0') %> + + <% } %> <% } %> @@ -41,17 +47,6 @@
<%- index && post.excerpt ? post.excerpt : post.content %>
- <% if (!index && (has_config('plugins.visit') ? get_config('plugins.visit') : false)) { %> -
-
- -   - - 0 - -
-
- <% } %> <% if (!index && post.tags && post.tags.length) { %>
diff --git a/layout/common/footer.ejs b/layout/common/footer.ejs index e6ef4fc..ac4dfbb 100644 --- a/layout/common/footer.ejs +++ b/layout/common/footer.ejs @@ -13,17 +13,13 @@ © <%= date(new Date(), 'YYYY') %> <%= get_config('author') || get_config('title') %>  Powered by Hexo & Icarus -

- <% if (has_config('plugins.visit') ? get_config('plugins.visit') : false) { %> -

- - UV:0, - - - PV:0 - -

+ <% if (has_config('plugins.busuanzi') ? get_config('plugins.busuanzi') : false) { %> +
+ + <%- _p('plugin.visitor', '0') %> + <% } %> +

<% if (has_config('footer.links')) { %> diff --git a/layout/plugin/visit.ejs b/layout/plugin/busuanzi.ejs similarity index 100% rename from layout/plugin/visit.ejs rename to layout/plugin/busuanzi.ejs diff --git a/layout/plugin/mathjax.ejs b/layout/plugin/mathjax.ejs index 26604f3..a9585ee 100644 --- a/layout/plugin/mathjax.ejs +++ b/layout/plugin/mathjax.ejs @@ -3,9 +3,21 @@