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