New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring comments #711
Closed
Closed
Refactoring comments #711
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9040b19
Refactoring comment
jiangtj c41eca9
fix path
jiangtj bcc138b
fix
jiangtj a4876a3
Fix
jiangtj ed463b2
ignore missing
jiangtj 15fbb45
Fix config
jiangtj 3af6b49
Merge branch 'comments' of https://github.com/JiangTJ/hexo-theme-next…
jiangtj 1c64b9a
Merge branch 'master' into comments
jiangtj 1ceb3d6
Fix vk
jiangtj 679cc55
Change config
jiangtj 9bf244b
fix count
jiangtj e39f8cd
Fix count divider in head and display condition
jiangtj 3ae9587
Fix valine and gitment count
jiangtj 456840f
Fix styl
jiangtj 69ab318
Merge branch 'master' into comments
jiangtj 5347654
docs
jiangtj 139e070
Add additional config
jiangtj c0a0380
Add additional config
jiangtj d94571c
Rm
jiangtj d4259e3
Merge branch 'master' into comments
ivan-nginx ab7f478
Merge branch 'master' into comments
jiangtj c3d6bc0
Update config file
jiangtj a5ade52
Add note
jiangtj 6f2b87e
Use partial instead of include
jiangtj e015d2c
Fix QA
jiangtj 03e34f4
Merge branch 'master' into comments
jiangtj File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -598,20 +598,28 @@ calendar: | |
# --------------------------------------------------------------- | ||
# Comments and Widgets | ||
# See: https://theme-next.org/docs/third-party-services/comments-and-widgets | ||
# You can set one type to enable. | ||
# And need to provide additional configurations are required for those types. | ||
# Note: facebook_comments_plugin and vkontakte have to enable SDK. | ||
# --------------------------------------------------------------- | ||
comments: | ||
# Type list: | ||
# disqus | disqusjs | changyan | valine | livere | gitment | gitalk | facebook_comments_plugin | vkontakte | ||
type: | ||
# If comment system support, show comments count in meta area | ||
count: | ||
page: true | ||
post: true | ||
|
||
# Disqus | ||
disqus: | ||
enable: false | ||
shortname: | ||
count: true | ||
lazyload: false | ||
|
||
# DisqusJS | ||
# Alternative Disqus - Render comment component using Disqus API | ||
# Demo: https://suka.js.org/DisqusJS/ | ||
disqusjs: | ||
enable: false | ||
# API Endpoint of Disqus API (https://disqus.com/api/) | ||
# leave api empty if you are able to connect to Disqus API | ||
# otherwise you need a reverse proxy for Disqus API | ||
|
@@ -623,15 +631,14 @@ disqusjs: | |
|
||
# Changyan | ||
changyan: | ||
enable: false | ||
appid: | ||
appkey: | ||
|
||
# Valine | ||
# You can get your appid and appkey from https://leancloud.cn | ||
# More info available at https://valine.js.org | ||
# When comments.type is set to valine, leancloud_visitors is recommended to be closed for the re-initialization problem within different leancloud adk version. | ||
valine: | ||
enable: false # When enable is set to be true, leancloud_visitors is recommended to be closed for the re-initialization problem within different leancloud adk version. | ||
appid: # your leancloud application appid | ||
appkey: # your leancloud application appkey | ||
notify: false # mail notifier, See: https://github.com/xCss/Valine/wiki | ||
|
@@ -642,7 +649,6 @@ valine: | |
pageSize: 10 # pagination size | ||
language: # language, available values: en, zh-cn | ||
visitor: false # leancloud-counter-security is not supported for now. When visitor is set to be true, appid and appkey are recommended to be the same as leancloud_visitors' for counter compatibility. Article reading statistic https://valine.js.org/visitor.html | ||
comment_count: true # if false, comment count will only be displayed in post page, not in home page | ||
|
||
# LiveRe comments system | ||
# You can get your uid from https://livere.com/insight/myCode (General web site) | ||
|
@@ -651,9 +657,7 @@ valine: | |
# Gitment | ||
# Introduction: https://github.com/imsun/gitment | ||
gitment: | ||
enable: false | ||
mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway | ||
count: true # Show comments count in post meta area | ||
lazy: false # Comments lazy loading with a button | ||
cleanly: false # Hide 'Powered by ...' on footer, and more | ||
language: # Force language, or auto switch by theme | ||
|
@@ -667,7 +671,6 @@ gitment: | |
# Gitalk | ||
# Demo: https://gitalk.github.io | ||
gitalk: | ||
enable: false | ||
github_id: # Github repo owner | ||
repo: # Repository name to store issues | ||
client_id: # Github Application Client ID | ||
|
@@ -777,7 +780,6 @@ facebook_sdk: | |
# This plugin depends on Facebook SDK. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Carefully here. Facebook, like VK, have own SDK (API). I think need to make similar as VK. |
||
# If facebook_sdk.enable is false, Facebook comments plugin is unavailable. | ||
facebook_comments_plugin: | ||
enable: false | ||
num_of_posts: 10 # min posts num is 1 | ||
width: 100% # default width is 550px | ||
scheme: light # default scheme is light (light or dark) | ||
|
@@ -788,7 +790,6 @@ vkontakte_api: | |
enable: false | ||
app_id: #<app_id> | ||
like: true | ||
comments: true | ||
num_of_posts: 10 | ||
|
||
# Star rating support to each article. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,6 @@ | ||
{% if page.comments %} | ||
|
||
{% if theme.facebook_sdk.enable and theme.facebook_comments_plugin.enable %} | ||
<div class="comments" id="comments"> | ||
<div class="fb-comments" | ||
data-href="{{ page.permalink }}" | ||
data-numposts="{{ theme.facebook_comments_plugin.num_of_posts }}" | ||
data-width="{{ theme.facebook_comments_plugin.width }}" | ||
data-colorscheme="{{ theme.facebook_comments_plugin.scheme }}"> | ||
</div> | ||
</div> | ||
|
||
{% elif theme.vkontakte_api.enable and theme.vkontakte_api.comments %} | ||
<div class="comments" id="comments"> | ||
<div id="vk_comments"></div> | ||
</div> | ||
|
||
{% elif theme.disqus.enable or (theme.disqusjs.enable and theme.disqusjs.apikey and theme.disqusjs.shortname) %} | ||
<div class="comments" id="comments"> | ||
<div id="disqus_thread"> | ||
<noscript>{# | ||
#}Please enable JavaScript to view the comments powered by Disqus.{# | ||
#}</noscript> | ||
</div> | ||
</div> | ||
|
||
{% elif theme.livere_uid %} | ||
<div class="comments" id="comments"> | ||
<div id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div> | ||
</div> | ||
|
||
{% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %} | ||
<div class="comments" id="comments"> | ||
<div id="SOHUCS"></div> | ||
</div> | ||
|
||
{% elif theme.gitment.enable %} | ||
<div class="comments" id="comments"> | ||
{% if theme.gitment.lazy %} | ||
<div onclick="showGitment()" id="gitment-display-button">{{ __('gitmentbutton') }}</div> | ||
<div id="gitment-container" style="display: none"></div> | ||
{% else %} | ||
<div id="gitment-container"></div> | ||
{% endif %} | ||
</div> | ||
|
||
{% elif theme.valine.enable and theme.valine.appid and theme.valine.appkey %} | ||
<div class="comments" id="comments"> | ||
</div> | ||
|
||
{% elif theme.gitalk.enable %} | ||
<div class="comments" id="gitalk-container"> | ||
</div> | ||
|
||
{% if theme.comments.type %} | ||
{% set comments_comment_path = '_third-party/comments/' + theme.comments.type|lower + '/comment.swig' %} | ||
{{ partial(comments_comment_path) }} | ||
{% endif %} | ||
|
||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% if theme.changyan.appid and theme.changyan.appkey %} | ||
<div class="comments" id="comments"> | ||
<div id="SOHUCS"></div> | ||
</div> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% if theme.changyan.appid and theme.changyan.appkey %} | ||
<span class="post-comments-count"> | ||
<span class="post-meta-divider">|</span> | ||
<span class="post-meta-item-icon"> | ||
<i class="fa fa-comment-o"></i> | ||
</span> | ||
{% if is_post() %} | ||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span> | ||
<a href="{{ url_for(post.path) }}#SOHUCS" itemprop="discussionUrl"> | ||
<span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="{{ post.path }}" itemprop="commentCount"></span> | ||
</a> | ||
{% else %} | ||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span> | ||
<a href="{{ url_for(post.path) }}#SOHUCS" itemprop="discussionUrl"> | ||
<span id="url::{{ post.permalink }}" class="cy_cmt_count" data-xid="{{ post.path }}" itemprop="commentCount"></span> | ||
</a> | ||
{% endif %} | ||
</span> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% if theme.disqus.shortname %} | ||
<div class="comments" id="comments"> | ||
<div id="disqus_thread"> | ||
<noscript>{# | ||
#}Please enable JavaScript to view the comments powered by Disqus.{# | ||
#}</noscript> | ||
</div> | ||
</div> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% if theme.disqus.shortname %} | ||
<span class="post-comments-count"> | ||
<span class="post-meta-divider">|</span> | ||
<span class="post-meta-item-icon"> | ||
<i class="fa fa-comment-o"></i> | ||
</span> | ||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span> | ||
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl"> | ||
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="{{ post.path }}" itemprop="commentCount"></span> | ||
</a> | ||
</span> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% if theme.disqusjs.apikey and theme.disqusjs.shortname %} | ||
<div class="comments" id="comments"> | ||
<div id="disqus_thread"> | ||
<noscript>{# | ||
#}Please enable JavaScript to view the comments powered by Disqus.{# | ||
#}</noscript> | ||
</div> | ||
</div> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
layout/_third-party/comments/facebook_comments_plugin/comment.swig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% if theme.facebook_sdk.enable %} | ||
<div class="comments" id="comments"> | ||
<div class="fb-comments" | ||
data-href="{{ page.permalink }}" | ||
data-numposts="{{ theme.facebook_comments_plugin.num_of_posts }}" | ||
data-width="{{ theme.facebook_comments_plugin.width }}" | ||
data-colorscheme="{{ theme.facebook_comments_plugin.scheme }}"> | ||
</div> | ||
</div> | ||
{% endif %} |
12 changes: 12 additions & 0 deletions
12
layout/_third-party/comments/facebook_comments_plugin/count.swig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% if theme.facebook_sdk.enable %} | ||
<span class="post-comments-count"> | ||
<span class="post-meta-divider">|</span> | ||
<span class="post-meta-item-icon"> | ||
<i class="fa fa-comment-o"></i> | ||
</span> | ||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span> | ||
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl"> | ||
<span class="post-comments-count fb-comments-count" data-href="{{ post.permalink }}" itemprop="commentCount">0</span> | ||
</a> | ||
</span> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class="comments" id="gitalk-container"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="comments" id="comments"> | ||
{% if theme.gitment.lazy %} | ||
<div onclick="showGitment()" id="gitment-display-button">{{ __('gitmentbutton') }}</div> | ||
<div id="gitment-container" style="display: none"></div> | ||
{% else %} | ||
<div id="gitment-container"></div> | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% if is_post() and theme.gitment.mint %} | ||
<span class="post-comments-count"> | ||
<span class="post-meta-divider">|</span> | ||
<span class="post-meta-item-icon"> | ||
<i class="fa fa-comment-o"></i> | ||
</span> | ||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span> | ||
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl"> | ||
<span class="post-comments-count gitment-comments-count" data-xid="{{ url_for(post.path) }}" itemprop="commentsCount"></span> | ||
</a> | ||
</span> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You delete options from comments above?