为hexo博客创建一个基于valine的评论系统

一.注册LearnCloud

Valine 是基于 LeanCloud 进行使用的,所以我们需要在 LeanCloud 进行注册

二.配置LearnCloud

1.创建应用

按下图创建应用,名字随便取。

2.创建class

切换到数据页面

看有没有涂黄色的两个应用,没有就创建一下。创建完记得把权限设为无限制。

3.设置安全域名

在Web安全域名里面填上你的博客域名,保存一下。记得把结尾的斜线去掉。

4.取得应用凭证

分别复制这里的两个ID,填到主题设置文件里面Valine的相应位置,保存。然后用git执行:
hexo d -g

好的,Shift+F5刷新下博客看看吧,是不是有评论系统和评论统计了?
全文完。

附:

Valine的设置如下所示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Valine
# You can get your appid and appkey from https://leancloud.cn
# More info available at https://valine.js.org
valine:
enable: true # When enable is set to be true, leancloud_visitors is recommended to be closed for the re-initialization problem within different leancloud adk version.
appid: #填入你的appdi
appkey: #填入你的appkey
notify: false # mail notifier, See: https://github.com/xCss/Valine/wiki
verify: false # Verification code
placeholder: 来呀,随便说两句! # 这里的内容会默认显示在评论框里面,可自由修改
avatar: mm # gravatar style
guest_info: nick,mail,link # custom comment header
pageSize: 10 # pagination size
visitor: false # leancloud-counter-security is not supported for now. When visitor is set to be true, appid and appkey are recommended to be the same as leancloud_visitors' for counter compatibility. Article reading statistic https://valine.js.org/visitor.html
comment_count: true # 这里决定在home页是否显示评论数量
displayed in post page, not in home page

无华0871 wechat
感谢阅读!欢迎扫码订阅我的公众号!