From 8e65ed151222b1af70326b559c142c269b49e7f7 Mon Sep 17 00:00:00 2001
From: 799953468 <799953468@qq.com>
Date: Wed, 6 May 2020 15:26:57 +0800
Subject: [PATCH] Add display options
---
_config.yml | 2 ++
scripts/filters/comment/changyan.js | 18 ++++++++++--------
scripts/filters/comment/disqus.js | 16 +++++++++-------
scripts/filters/comment/valine.js | 16 +++++++++-------
4 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/_config.yml b/_config.yml
index 394c4825d9..3f68b68a6c 100644
--- a/_config.yml
+++ b/_config.yml
@@ -571,6 +571,8 @@ comments:
storage: true
# Lazyload all comment systems.
lazyload: false
+ # Show on home page
+ display: true
# Modify texts or order for any navs, here are some examples.
nav:
#disqus:
diff --git a/scripts/filters/comment/changyan.js b/scripts/filters/comment/changyan.js
index a333b7b4c7..f459da3de8 100644
--- a/scripts/filters/comment/changyan.js
+++ b/scripts/filters/comment/changyan.js
@@ -29,14 +29,16 @@ hexo.extend.filter.register('theme_inject', injects => {
{% if post.comments %}
${iconText('far fa-comment', 'changyan')}
- {% if is_post() %}
-
-
-
- {% else %}
-
-
-
+ {% if theme.comments.display %}
+ {% if is_post() %}
+
+
+
+ {% else %}
+
+
+
+ {% endif %}
{% endif %}
{% endif %}
diff --git a/scripts/filters/comment/disqus.js b/scripts/filters/comment/disqus.js
index 1aa6418554..909e1b0aa2 100644
--- a/scripts/filters/comment/disqus.js
+++ b/scripts/filters/comment/disqus.js
@@ -28,13 +28,15 @@ hexo.extend.filter.register('theme_inject', injects => {
if (!theme.disqus.enable || !theme.disqus.shortname || !theme.disqus.count) return;
injects.postMeta.raw('disqus', `
- {% if post.comments %}
-
- ${iconText('far fa-comment', 'disqus')}
-
-
-
-
+ {% if theme.comments.display %}
+ {% if post.comments %}
+
+ ${iconText('far fa-comment', 'disqus')}
+
+
+
+
+ {% endif %}
{% endif %}
`, {}, {}, theme.disqus.post_meta_order);
diff --git a/scripts/filters/comment/valine.js b/scripts/filters/comment/valine.js
index d2808e70d1..bb66b2d04a 100644
--- a/scripts/filters/comment/valine.js
+++ b/scripts/filters/comment/valine.js
@@ -22,13 +22,15 @@ hexo.extend.filter.register('theme_inject', injects => {
if (!theme.valine.enable || !theme.valine.appid || !theme.valine.appkey) return;
injects.postMeta.raw('valine', `
- {% if post.comments and (is_post() or theme.valine.comment_count) %}
-
- ${iconText('far fa-comment', 'valine')}
-
-
-
-
+ {% if theme.comments.display %}
+ {% if post.comments and (is_post() or theme.valine.comment_count) %}
+
+ ${iconText('far fa-comment', 'valine')}
+
+
+
+
+ {% endif %}
{% endif %}
`, {}, {}, theme.valine.post_meta_order);