ud_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是第三方插件,需要到https://leancloud.cn注册账号,获取到appid和appkey后放到这里即可。avatar是设置默认头像,可以到https://valine.js.org/avatar选择默认头像,然后在这里设置名字即可。
开启百度分享
# Baidu Share
# Available values: button | slide
# Warning: Baidu Share does not support https.
baidushare:
type: button # 设置分享按钮的风格,有button何slide形式
开启needmoreshare分享
needmoreshare2:
enable: false
postbottom:
enable: false
options:
iconStyle: box
boxForm: horizontal
position: bottomCenter
networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook
float:
enable: false
options:
iconStyle: box
boxForm: horizontal
position: middleRight
networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook
needmoreshare2依赖theme-next-needmoreshare2模块,要开启的朋友可以到https://github.com/theme-next/theme-next-needmoreshare2找到方法。
设置文章阅读量
leancloud_visitors:
enable: true
app_id:
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`.
security: false
betterPerformance: true
appid和appkey跟上面开启valine评论使用的leanCloud是一样的。如果发现文章阅读量不显示,可以到leanCloud后台的存储菜单下,创建Class,命名为Counter.
开启不蒜子统计功能
busuanzi_count:
enable: true
total_visitors: true #开启总访客(uv)
total_visitors_icon: user
total_views: true #开启总访问数(pv)
total_views_icon: eye
post_views: false
post_views_icon: eye
这边的post_views和上面的leanCloud_visitors冲突,两者都是显示文章阅读量,只开启一个就可以了。
开启本地博客搜索功能
local_search:
enable: false
# If auto, trigger search by changing input.
# If manual, trigger search by pressing enter key or search button.
trigger: auto
# Show top n results per article, show all results by setting to -1
top_n_per_article: 1
# Unescape html strings to the readable one.
unescape: false
该功能依赖hexo-generator-searchdb
插件,使用命令npm install hexo-generator-searchdb --save
来进行安装,然后在全局配置文件的末尾,加入以下代码即可。
search:
path: search.xml
field: post
format: html
limit: 10000
总结
以上就是hexo博客常用的基本配置以及基于Next主题的一些设置,更多功能大家可在使用中逐摸索,欢迎讨论交流。
需要安装的模块依赖
1.字数统计:npm install hexo-symbols-count-time --save
2.相关文章推荐:npm install hexo-related-popular-posts --save
3.本地博客搜索功能:npm install hexo-generator-searchdb --save
,然后在全局配置文件末尾加入代码
第三方插件
1.valine评论系统:需要到https://leancloud.cn注册账号,获取到appid和appkey
2.文章阅读量:同样需要用到leancloud的appid和appkey