hexo的nexT框架支持閱讀統(tǒng)計和評論的功能博助,我們需要用到leancloud賬號陡叠,將統(tǒng)計數(shù)據(jù)和評論內(nèi)容存儲到leancloud上,具體步驟如下
leancloud
送上傳送門leancloud
1.首先需要創(chuàng)建一個應(yīng)用特碳,我們可以命名為mblog蹋岩,選擇開發(fā)版
image.png
2.然后創(chuàng)建class實例
創(chuàng)建Counter,設(shè)置數(shù)據(jù)條目的默認(rèn)為無限制
image.png
Counter實例存儲閱讀統(tǒng)計信息杆逗,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
重新發(fā)布博客
效果如下
閱讀統(tǒng)計
image.png
評論功能
image.png