为hexo添加view统计
阅读统计
基于leancloud的文章阅读统计,将显示在文章标题下
- leancloud在leancloud 官网注册账号 
- 创建一个新的应用
名称可以随意输入,进入应用在设置中的存储选项下选择结构化数据
创建一个Counter的表格作为计数用
- 将id 和key填入_config.yml
 id 和 key 在leancloud设置中可以找到
- 完成后将博文重新编译可以先在本地查看效果提示计数器没有初始化,在网上查找到一个方法期间遇到一个问题: 
 Counter not initialized! More info at console err msg将security设为false, 摘取自轩辕御龙 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11leancloud_visitors: 
 enable: true
 app_id: # 填入leancloud<app_id>
 app_key: # <app_key>
 # Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
 # If you don't care about security in leancloud counter and just want to use it directly
 # (without hexo-leancloud-counter-security plugin), set `security` to `false`.
 # 解决办法是用npm 下载hexo-leancloud-counter-security 模块
 # 然后将security 设为false
 security: false #如果要为true
 betterPerformance: false
- 但是如果你一定要启用security的话,hexo g遇到以下报错: 
 Cannot read property ‘enable_sync’ of undefined- 参照以下建议在`_config.yml`中添加 摘取自清欢ysy - 1 
 2
 3
 4
 5
 6- leancloud_counter_security: 
 enable_sync: true
 app_id: # leancloud id
 app_key: # leancloud key
 username: # 用户名/邮箱
 password: # 密码