Hexo博客增加评论和浏览量统计

在Hexo最新的Next主题中已经集成了valine和busuanzi_count,我们只需要修改配置文件启用这些插件就可以了。

启用busuanzi_count

打开博客目录下的themes\next_config.yml文件,把busuanzi_countd中enable的值false改为true就可以完成配置了

busuanzi_count:
  enable: true
  total_visitors: true
  total_visitors_icon: user
  total_views: true
  total_views_icon: eye
  post_views: true
  post_views_icon: eye

启用valine

想要使用Valine插件我们需要注册一个Leancloud账号。
Leancloud提供体验版服务,对于小型博客来说暂时是够用了。

数据存储
总请求数不超过每日 30,000 次
云端并发线程数低于 3 个
免费赠送 1 GB 对象存储
无自动备份

注册完之后创建一个应用,进到设置 -> 应用Keys 记下你的AppID和AppKey。

打开博客目录下的themes\next_config.yml文件

找到valine的配置,填上appid和appkey然后把enable的值false改为true就可以完成配置了

valine:
  enable: false # 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: # Your leancloud application appid
  appkey: # Your leancloud application appkey
  notify: false # Mail notifier. See: https://github.com/xCss/Valine/wiki
  verify: false # Verification code
  placeholder: Just go go # Comment box placeholder
  avatar: mm # 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
  recordIP: false # Whether to record the commenter IP
  serverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)
  #post_meta_order: 0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值