Skip to content

Commit

Permalink
Merge pull request #337 from xCss/card
Browse files Browse the repository at this point in the history
add valine comment support
  • Loading branch information
yscoder committed Nov 19, 2017
2 parents 415582b + e7c0019 commit f1fee40
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
14 changes: 14 additions & 0 deletions _config.yml
Expand Up @@ -113,6 +113,20 @@ gitment: false
# client_id:
# client_secret:

# Valine Comment system. https://valine.js.org
valine:
enable: false # 如果你想使用valine,请将值设置为 true
appId: # your leancloud appId
appKey: # your leancloud appKey
notify: false # Mail notify
verify: false # Verify code
avatar: mm # Gravatar style : mm/identicon/monsterid/wavatar/retro/hide
placeholder: Just go go # Comment Box placeholder
guest_info: nick,mail,link # Comment header info
pageSize: 10 # comment list page size



# 规范网址
# 让搜索引擎重定向你的不同域名、不同子域、同域不同目录的站点到你期望的路径
# https://support.google.com/webmasters/answer/139066
Expand Down
4 changes: 4 additions & 0 deletions layout/_partial/plugins/valine.ejs
@@ -0,0 +1,4 @@
<% if (theme.valine.enable ){ %>
<div class="comments vcomment" id="comments"></div>
<% } %>

2 changes: 2 additions & 0 deletions layout/_partial/post/comment.ejs
Expand Up @@ -5,4 +5,6 @@
<%- partial('../plugins/uyan') %>
<%- partial('../plugins/gitment') %>
<%- partial('../plugins/valine') %>
<%} %>
27 changes: 27 additions & 0 deletions layout/_partial/script.ejs
Expand Up @@ -20,3 +20,30 @@ lazyScripts.push('//s95.cnzz.com/z_stat.php?id=<%-theme.cnzz %>&web_id=<%-theme.
<% } %>

<%- partial('plugins/dynamic-title') %>


<!-- Valine Comments -->
<% if (theme.valine.enable){ %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script>
<script type="text/javascript">
var notify = '<%= theme.valine.notify %>' == true ? true : false;
var verify = '<%= theme.valine.verify %>' == true ? true : false;
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '<%= theme.valine.guest_info %>'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info;
new Valine({
el: '.vcomment',
notify: notify,
verify: verify,
appId: "<%= theme.valine.appId %>",
appKey: "<%= theme.valine.appKey %>",
avatar:"<%= theme.valine.avatar %>",
placeholder: "<%= theme.valine.placeholder %>",
guest_info:guest_info,
pageSize:"<%= theme.valine.pageSize %>"
})
</script>
<% } %>

0 comments on commit f1fee40

Please sign in to comment.