refactor: modify the use and configuration of the comment feature
This commit is contained in:
parent
0d01cbf816
commit
73c63d5c88
|
@ -167,10 +167,12 @@ local_search:
|
|||
# Comment plugin
|
||||
# ---------------------------------------------------------------------------------------
|
||||
comment:
|
||||
enable: false
|
||||
use: valine # values: valine | gitalk | twikoo
|
||||
|
||||
# Valine
|
||||
# See: https://github.com/xCss/Valine
|
||||
valine:
|
||||
enable: false
|
||||
appid: # your leancloud application appid
|
||||
appkey: # your leancloud application appkey
|
||||
placeholder: # your placeholder
|
||||
|
@ -178,7 +180,6 @@ comment:
|
|||
# Gitalk
|
||||
# See: https://github.com/gitalk/gitalk
|
||||
gitalk:
|
||||
enable: false
|
||||
github_id: # GitHub repo owner
|
||||
repository: # Repository name to store issues
|
||||
client_id: # GitHub Application Client ID
|
||||
|
@ -187,7 +188,6 @@ comment:
|
|||
# Twikoo
|
||||
# See: https://github.com/imaegoo/twikoo
|
||||
twikoo:
|
||||
enable: false
|
||||
env_id: # Tencent Cloud environment id
|
||||
region: # environment region. If select Guangzhou, fill in "ap-guangzhou".
|
||||
|
||||
|
|
|
@ -3,11 +3,17 @@
|
|||
<div class="comment-area-title">
|
||||
<i class="fas fa-comments"> <%- __('comments') %></i>
|
||||
</div>
|
||||
<% if (theme.comment.valine.enable === true) { %>
|
||||
<% if (theme.comment.enable === true && theme.comment.hasOwnProperty(theme.comment.use)) { %>
|
||||
|
||||
<% if (theme.comment.use === 'valine') { %>
|
||||
<%- partial('valine') %>
|
||||
<% } else if (theme.comment.gitalk.enable === true) { %>
|
||||
|
||||
<% } else if (theme.comment.use === 'gitalk') { %>
|
||||
<%- partial('gitalk') %>
|
||||
<% } else if (theme.comment.twikoo.enable === true) { %>
|
||||
|
||||
<% } else if (theme.comment.use === 'twikoo') { %>
|
||||
<%- partial('twikoo') %>
|
||||
|
||||
<% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if(
|
||||
theme.comment.gitalk.enable
|
||||
theme.comment.use === 'gitalk'
|
||||
&& theme.comment.gitalk.client_id
|
||||
&& theme.comment.gitalk.client_secret
|
||||
&& theme.comment.gitalk.github_id
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% if(theme.comment.twikoo.enable === true && theme.comment.twikoo.env_id) { %>
|
||||
<% if(theme.comment.use === 'twikoo' && theme.comment.twikoo.env_id) { %>
|
||||
<div class="twikoo-container">
|
||||
<script <%= theme.pjax.enable === true ? 'data-pjax' : '' %>
|
||||
src="//cdn.jsdelivr.net/npm/twikoo@1.0.0/dist/twikoo.all.min.js"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if(
|
||||
theme.comment.valine.enable
|
||||
theme.comment.use === 'valine'
|
||||
&& theme.comment.valine.appid
|
||||
&& theme.comment.valine.appkey
|
||||
) { %>
|
||||
|
|
|
@ -8,11 +8,7 @@
|
|||
<% } %>
|
||||
|
||||
<!-- go comment -->
|
||||
<% if (
|
||||
theme.comment.valine.enable
|
||||
|| theme.comment.gitalk.enable
|
||||
|| theme.comment.twikoo.enable
|
||||
) { %>
|
||||
<% if (theme.comment.enable === true && theme.comment.hasOwnProperty(theme.comment.use)) { %>
|
||||
<li class="go-comment">
|
||||
<i class="fas fa-comment"></i>
|
||||
</li>
|
||||
|
|
|
@ -77,11 +77,7 @@
|
|||
</div>
|
||||
<% } %>
|
||||
|
||||
<% if (
|
||||
theme.comment.valine.enable
|
||||
|| theme.comment.gitalk.enable
|
||||
|| theme.comment.twikoo.enable
|
||||
) { %>
|
||||
<% if (theme.comment.enable === true && theme.comment.hasOwnProperty(theme.comment.use)) { %>
|
||||
<div class="comment-container">
|
||||
<%- partial('_partial/comment/comment') %>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
if (hexo-config('comment.valine.enable')) {
|
||||
if (hexo-config('comment.enable') == true && hexo-config('comment.use') != "") {
|
||||
if (hexo-config('comment.use') == "valine") {
|
||||
@require "./valine.styl";
|
||||
|
||||
} else if (hexo-config('comment.gitalk.enable')) {
|
||||
} else if (hexo-config('comment.use') == "gitalk") {
|
||||
@require "./gitalk.styl";
|
||||
|
||||
} else if (hexo-config('comment.twikoo.enable')) {
|
||||
} else if (hexo-config('comment.use') == "twikoo") {
|
||||
@require "./twikoo.styl";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.comments-container {
|
||||
|
|
Loading…
Reference in New Issue