• leanCloud 创建应用 获取 appid和appkey
  • _config.yml文件添加
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Valine.
# You can get your appid and appkey from https://leancloud.cn
# more info please open https://valine.js.org
valine:
enable: true
appid: ************************************
appkey: *****************************
notify: true # 评论回复提醒
verify: true # 验证码
placeholder: Please leave your footprints....
enableQQ: true
avatar: wavatar
tag:
master: 博主
friends: 小伙伴
eachother: 访客
emailSet:
master: ["c2d3a0cc0e960d0378ed2ca174feb84f"] #博主邮箱md5
friends: ["",""] #标识为小伙伴的邮箱不添加则标识为访客
metaPlaceholder:
name: 昵称/QQ号(输入QQ号邮箱能自动回显)
email: 邮箱
url: 网址(http://)
  • Chic\layout_plugins 下添加 valine.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<div class="valine_comment"></div>
<!--载入js,在</body>之前插入即可-->
<!--Leancloud 操作库:-->
<script src="/blog/js/av-min.js"></script>
<!--Valine 的核心代码库-->
<script src="/blog/js/Valine.min.js"></script>
<script>
new Valine({
el: '.valine_comment',
app_id: '<%= theme.valine.appid %>',
app_key: '<%= theme.valine.appkey %>',
placeholder: '<%= theme.valine.placeholder %>',
notify: '<%= theme.valine.notify %>',
verify: '<%= theme.valine.verify %>',
enableQQ: '<%= theme.valine.enableQQ %>',
master: '<%= theme.valine.emailSet.master %>',
friends: '<%= theme.valine.emailSet.friends %>',
tagMeta: new Array("<%= theme.valine.tag.master %>","<%= theme.valine.tag.friends %>","<%= theme.valine.tag.eachother %>"),
metaPlaceholder: {"nick":"<%= theme.valine.metaPlaceholder.name %>","mail":"<%= theme.valine.metaPlaceholder.email %>","link":"<%= theme.valine.metaPlaceholder.url %>"},
avatar: '<%= theme.valine.avatar %>',
});
</script>
  • Chic\source\js 添加 文件 Valine.min.js 和 av-min.js

地址为 https://simplemw.gitee.io/blog/js/Valine.min.js

https://simplemw.gitee.io/blog/js/av-min.js

注:Valine.min.js是找的魔改版,比原官方多的功能是输入qq号自动获取头像和邮箱

  • 评论输入区加了图片,在 Chic\source\image 中添加 comment.jpg图片

  • 启动后看样式,若出现格式不对 则修改 Valine.min.js文件