Hexo博客的阅读统计和评论功能

hexo的nexT框架支持阅读统计和评论的功能,我们需要用到leancloud账号,将统计数据和评论内容存储到leancloud上,具体步骤如下

leancloud

送上传送门leancloud
1.首先需要创建一个应用,我们可以命名为mblog,选择开发版

image.png

2.然后创建class实例
创建Counter,设置数据条目的默认为无限制

image.png

Counter实例存储阅读统计信息,Comment实例存储评论功能,Comment实例在配置好nexT后会自动生成
3.在安全中心添加你的博客域名


image.png

4.记住AppId和AppKey


image.png

配置next的_config.yml

# Valine.
# You can get your appid and appkey from https://leancloud.cn
# more info please open https://valine.js.org
valine:
  enable: true
  appid:  填自己的appid
  appkey:  填自己的appkey
  notify: false # mail notifier , https://github.com/xCss/Valine/wiki
  verify: false # Verification code
  placeholder: 欢迎留言 # comment box placeholder
  avatar: source/images/headico.jpg # gravatar style
  guest_info: nick,mail,link # custom comment header
  pageSize: 10 # pagination size
# Show number of visitors to each article.
# You can visit https://leancloud.cn get AppID and AppKey.
leancloud_visitors:
  enable: true
  appid:  填自己的appid
  appkey:  填自己的appkey

重新发布博客

效果如下
阅读统计


image.png

评论功能


image.png
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容