Add: add Valine comment system support (#278)

* Add: add Valine comment system support

*  add complete configurations checking
This commit is contained in:
Nine 2017-08-31 12:13:03 +08:00 committed by Ruipeng Zhang
parent fb574207f9
commit 3e66b25aaa
4 changed files with 33 additions and 1 deletions

View File

@ -50,7 +50,7 @@ search:
# Comment
comment:
disqus: hexo-theme-icarus # enter disqus shortname here
disqus: # enter disqus shortname here
duoshuo: # enter duoshuo shortname here
youyan: # enter youyan uid here
facebook: # enter true to enable
@ -65,6 +65,14 @@ comment:
client_id: #your client ID
client_secret: #your client secret
livere: # enter livere uid here
valine: # Valine Comment System https://github.com/xCss/Valine
on: # enter true to enable
appId: # enter the leancloud application appId here
appKey: # enter the leancloud application appKey here
notify: # enter true to enable <Mail notifier> https://github.com/xCss/Valine/wiki/Valine-%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F%E4%B8%AD%E7%9A%84%E9%82%AE%E4%BB%B6%E6%8F%90%E9%86%92%E8%AE%BE%E7%BD%AE
verify: # enter true to enable <Validation code>
placeholder: Just Do It # enter the comment box placeholder
# Share
share: default # options: jiathis, bdshare, addtoany, default

View File

@ -13,6 +13,10 @@
<section id="comments"><%- partial('comment/changyan') %></section>
<% } else if (theme.comment.livere) { %>
<section id="comments"><%- partial('comment/livere') %></section>
<% } else if (theme.comment.valine.on &&
theme.comment.valine.appId &&
theme.comment.valine.appKey) { %>
<section id="comments"><%- partial('comment/valine') %></section>
<% } else if (theme.comment.gitment &&
theme.comment.gitment.owner &&
theme.comment.gitment.repo &&

View File

@ -18,4 +18,8 @@
<%- partial('comment/gitment', { script: true }) %>
<% } else if (theme.comment.livere) { %>
<%- partial('comment/livere', { script: true }) %>
<% } else if (theme.comment.valine.on &&
theme.comment.valine.appId &&
theme.comment.valine.appKey) { %>
<%- partial('comment/valine', { script: true }) %>
<% } %>

16
layout/comment/valine.ejs Normal file
View File

@ -0,0 +1,16 @@
<% if (typeof(script) !== 'undefined' && script) { %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//cdn.jsdelivr.net/gh/xcss/valine@v1.1.6/dist/Valine.min.js"></script>
<script>
new Valine({
el: '#valine-thread' ,
notify:<%= theme.comment.valine.notify %>,
verify:<%= theme.comment.valine.verify %>,
app_id: '<%= theme.comment.valine.appId %>',
app_key: '<%= theme.comment.valine.appKey %>',
placeholder: '<%= theme.comment.valine.placeholder %>'
});
</script>
<% } else { %>
<div id="valine-thread"></div>
<% } %>