From d360f9662dc06caabe9152e898b85e8fd98ee95b Mon Sep 17 00:00:00 2001 From: ppoffice Date: Sat, 6 Feb 2016 21:39:29 +0800 Subject: [PATCH] fix: comment counter don't display right comment count --- _config.yml.example | 9 ++-- layout/comment/counter.ejs | 9 ++++ layout/comment/disqus.ejs | 41 ++++++++------- layout/comment/duoshuo.ejs | 101 +++++++++++++++++++------------------ layout/comment/index.ejs | 18 +++---- layout/comment/scripts.ejs | 7 +++ layout/comment/youyan.ejs | 7 ++- layout/common/article.ejs | 6 +-- layout/common/header.ejs | 4 +- layout/common/profile.ejs | 2 +- layout/common/scripts.ejs | 1 + 11 files changed, 114 insertions(+), 91 deletions(-) create mode 100644 layout/comment/counter.ejs create mode 100644 layout/comment/scripts.ejs diff --git a/_config.yml.example b/_config.yml.example index 8469eb0..76ddd94 100644 --- a/_config.yml.example +++ b/_config.yml.example @@ -9,6 +9,7 @@ menu: # Customize customize: logo: + enabled: true width: 40 height: 40 url: images/logo.png @@ -17,10 +18,10 @@ customize: avatar: css/images/avatar.png gravatar: # Gravatar email address, if you enable Gravatar, your avatar config will be overriden author: PPOffice - author_title: 'Web Developer & Designer' - location: 'Harbin, China' + author_title: Web Developer & Designer + location: Harbin, China follow: https://github.com/ppoffice/ - highlight: androidstudio + highlight: monokai sidebar: right # sidebar position, options: left, right thumbnail: true # enable posts thumbnail, options: true, false favicon: # path to favicon @@ -43,7 +44,7 @@ widgets: # Search search: swiftype: # enter swiftype install key here - baidu: false # you need to disable other search engines to use Baidu search, options: true, false + baidu: true # you need to disable other search engines to use Baidu search, options: true, false # Comment comment: diff --git a/layout/comment/counter.ejs b/layout/comment/counter.ejs new file mode 100644 index 0000000..326f8cd --- /dev/null +++ b/layout/comment/counter.ejs @@ -0,0 +1,9 @@ +<% if (post.comments) { %> + <% if (theme.comment.disqus) { %> + <%= __('article.comments') %> + <% } else if (theme.comment.duoshuo) { %> + <%= __('article.comments') %> + <% } else if (theme.comment.youyan) { %> + <%= __('article.comments') %> + <% } %> +<% } %> \ No newline at end of file diff --git a/layout/comment/disqus.ejs b/layout/comment/disqus.ejs index aa2ca40..95aa0ee 100644 --- a/layout/comment/disqus.ejs +++ b/layout/comment/disqus.ejs @@ -1,19 +1,22 @@ -
- -
- \ No newline at end of file +<% if (typeof(script) !== 'undefined' && script) { %> + +<% } else { %> +
+ +
+<% } %> \ No newline at end of file diff --git a/layout/comment/duoshuo.ejs b/layout/comment/duoshuo.ejs index e879df2..63f4c61 100644 --- a/layout/comment/duoshuo.ejs +++ b/layout/comment/duoshuo.ejs @@ -1,49 +1,52 @@ -
- - \ No newline at end of file +<% if (typeof(script) !== 'undefined' && script) { %> + +<% } else { %> +
+ +<% } %> \ No newline at end of file diff --git a/layout/comment/index.ejs b/layout/comment/index.ejs index 52ede1f..1533c46 100644 --- a/layout/comment/index.ejs +++ b/layout/comment/index.ejs @@ -1,11 +1,11 @@ <% if (post.comments) { %> -
-<% if (theme.comment.disqus) { %> - <%- partial('comment/disqus') %> -<% } else if (theme.comment.duoshuo) { %> - <%- partial('comment/duoshuo') %> -<% } else if (theme.comment.youyan) { %> - <%- partial('comment/youyan') %> -<% } %> -
+
+ <% if (theme.comment.disqus) { %> + <%- partial('comment/disqus') %> + <% } else if (theme.comment.duoshuo) { %> + <%- partial('comment/duoshuo') %> + <% } else if (theme.comment.youyan) { %> + <%- partial('comment/youyan') %> + <% } %> +
<% } %> \ No newline at end of file diff --git a/layout/comment/scripts.ejs b/layout/comment/scripts.ejs new file mode 100644 index 0000000..979ce7c --- /dev/null +++ b/layout/comment/scripts.ejs @@ -0,0 +1,7 @@ +<% if (theme.comment.disqus) { %> + <%- partial('comment/disqus', { script: true }) %> +<% } else if (theme.comment.duoshuo) { %> + <%- partial('comment/duoshuo', { script: true }) %> +<% } else if (theme.comment.youyan) { %> + <%- partial('comment/youyan', { script: true }) %> +<% } %> \ No newline at end of file diff --git a/layout/comment/youyan.ejs b/layout/comment/youyan.ejs index 3cc6e2c..d45ed2f 100644 --- a/layout/comment/youyan.ejs +++ b/layout/comment/youyan.ejs @@ -1,2 +1,5 @@ -
- \ No newline at end of file +<% if (typeof(script) !== 'undefined' && script) { %> + +<% } else { %> +
+<% } %> \ No newline at end of file diff --git a/layout/common/article.ejs b/layout/common/article.ejs index ed801da..392a159 100644 --- a/layout/common/article.ejs +++ b/layout/common/article.ejs @@ -32,11 +32,7 @@ <% if (!index) { %> diff --git a/layout/common/header.ejs b/layout/common/header.ejs index 06d5bdf..c121bf4 100644 --- a/layout/common/header.ejs +++ b/layout/common/header.ejs @@ -2,7 +2,7 @@
- <% if(theme.customize.profile) { %> + <% if(theme.customize.profile && theme.customize.profile.enabled) { %>