sunwengang blog

Hexo Next主题集成Valine评论系统

字数统计: 415阅读时长: 2 min
2019/07/09 Share

注册leanCloud官网账号

为了避免混乱,可以和github使用同样的账号信息。

注册app

邮箱验证后,注册一个APP应用:alonealive.github.com_app
APP设置的安全中心选上数据存储,以及添加绑定的web域名。

配置_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
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: vh******sz # your leancloud application appid
appkey: Cf***2xz # your leancloud application appkey
notify: true # mail notifier, See: https://github.com/xCss/Valine/wiki
verify: false # Verification code
placeholder: Just go go # comment box placeholder
avatar: wavatar # gravatar style 评论头像
guest_info: nick,mail,link # custom comment header
pageSize: 10 # pagination size
language: zh-cn # language, available values: en, zh-cn
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 # if false, comment count will only be displayed in post page, not in home page

评论头像,点解链接查看

添加邮件提醒

参考:Valine评论系统中的邮件提醒设置

在邮件模板中,将重置密码的模板修改一下,邮件内容修改成:

1
2
3
4
5
<p>Hi, {{username}}</p>
<p>
你在 {{appname}} 的评论收到了新的回复,请点击查看:
</p>
<p><a href="你的网址首页链接" style="display: inline-block; padding: 10px 20px; border-radius: 4px; background-color: #3090e4; color: #fff; text-decoration: none;">马上查看</a></p>

保存后,提交代码发布网站测试。

去除标签页和类别页的分类

在他们的suource目录下的md文件添加:
comments: false

例如分类页面:

1
2
3
4
5
6
---
title: categories
date: 2019-05-08 22:40:04
type: "categories"
comments: false
---
CATALOG
  1. 1. 注册leanCloud官网账号
  2. 2. 注册app
    1. 2.1. 配置_config.yml
    2. 2.2. 添加邮件提醒
    3. 2.3. 去除标签页和类别页的分类