From 7c359ba5ae827e212d93fad13fdc7e7ee1ede07f Mon Sep 17 00:00:00 2001 From: Susreal Zhao Date: Sat, 2 Feb 2019 00:04:39 +0800 Subject: [PATCH] Show PV/UV of blog and PV of each article (#405) Show PV/UV of blog and PV of each article --- includes/specs/plugins.spec.js | 5 +++++ layout/common/article.ejs | 11 +++++++++++ layout/common/footer.ejs | 10 ++++++++++ layout/plugin/visit.ejs | 5 +++++ 4 files changed, 31 insertions(+) create mode 100644 layout/plugin/visit.ejs diff --git a/includes/specs/plugins.spec.js b/includes/specs/plugins.spec.js index 27b9b5a..2b13c0f 100644 --- a/includes/specs/plugins.spec.js +++ b/includes/specs/plugins.spec.js @@ -64,5 +64,10 @@ module.exports = { [type]: 'boolean', [doc]: 'Show the copy button in the highlighted code area', [defaultValue]: true + }, + visit: { + [type]: 'boolean', + [doc]: 'Show PV/UV of blog and PV of each article', + [defaultValue]: false } }; \ No newline at end of file diff --git a/layout/common/article.ejs b/layout/common/article.ejs index d3149f2..7eadebb 100644 --- a/layout/common/article.ejs +++ b/layout/common/article.ejs @@ -41,6 +41,17 @@
<%- 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 0024963..e6ef4fc 100644 --- a/layout/common/footer.ejs +++ b/layout/common/footer.ejs @@ -14,6 +14,16 @@ Powered by Hexo & Icarus

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

+ + UV:0, + + + PV:0 + +

+ <% } %>
<% if (has_config('footer.links')) { %> diff --git a/layout/plugin/visit.ejs b/layout/plugin/visit.ejs new file mode 100644 index 0000000..556c02b --- /dev/null +++ b/layout/plugin/visit.ejs @@ -0,0 +1,5 @@ +<% if (plugin !== false) { %> + <% if (head) { %> + + <% } %> +<% } %> \ No newline at end of file