Skip to content

Commit

Permalink
Merge pull request honjun#62 from Orange-Summer/master
Browse files Browse the repository at this point in the history
新增Waline评论系统
  • Loading branch information
honjun authored Nov 9, 2021
2 parents 2c51803 + 04b4471 commit 92f6d48
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
12 changes: 12 additions & 0 deletions themes/Sakura/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,15 @@ valine: true
v_appId: GyC3NzMvd0hT9Yyd2hYIC0MN-gzGzoHsz
v_appKey: mgOpfzbkHYqU92CV4IDlAUHQ

# Waline
waline:
enable: false
serverURL: #服务端地址
visitor: false #统计阅读量
comment_count: true #统计评论数
avatar: mp # Gravatar style : mp/identicon/monsterid/wavatar/retro/hide
guest_info: nick #,mail,link # custom comment header
pageSize: 10
placeholder: 祝开开心心! # Comment Box placeholder
requiredFields: [ 'nick','mail' ] #设置必填项
background: https://gitee.com/cungudafa/source/raw/master/img/gif/Sitich/Sitich2.gif #输入框提示动画
31 changes: 30 additions & 1 deletion themes/Sakura/layout/_partial/comment.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,33 @@
})
}
</script>
<% } %>
<% } %>

<% if (theme.waline.enable && post.comments) { %>
<script src="//cdn.jsdelivr.net/npm/@waline/client"></script>
<div id="waline"></div>
<style>
#waline textarea {
box-sizing: border-box;
background: url("<%- url_for(theme.waline.background) %>") 100% 100% no-repeat;
}
</style>
<script>
Waline({
el: '#waline',
serverURL: '<%- theme.waline.serverURL %>',
pageSize: '<%- theme.waline.pageSize %>',
lang: '<% if (config.language == "zh-cn") { %>zh-CN<% } else { %>en<% } %>',
requiredFields: ['nick','mail'], //设置必填项
placeholder: '<%= theme.waline.placeholder %>',
visitor: '<%- theme.waline.visitor %>',
emoji: [
'https://cdn.jsdelivr.net/gh/walinejs/[email protected]/tieba',
'https://cdn.jsdelivr.net/gh/walinejs/[email protected]/bilibili',
'https://cdn.jsdelivr.net/gh/walinejs/[email protected]/weibo',
],
avatar: '<%- theme.waline.avatar %>',
dark: 'auto',
});
</script>
<% } %>

0 comments on commit 92f6d48

Please sign in to comment.