这是我参与8月更文挑战的第15天,活动详情查看:8月更文挑战
本文介绍增加Next主题文章阅读数量和访客数量的方法。
不蒜子站点访客、文章阅读量
修改
主题配置文件不蒜子enable的开关为true:
# Show Views / Visitors of the website / page with busuanzi.
# Get more information on http://ibruce.info/2015/04/04/busuanzi
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
统计失效时的调整方法
有时数据统计会失效,此时删除hexo根目录的
db.json,执行命令:
hexo clean
hexo g
字符统计、阅读时间统计
启用 hexo-symbols-count-time ,官方Github链接,执行命令:
npm install hexo-symbols-count-time
在
站点配置文件加入:
symbols_count_time:
symbols: true # 文章字数统计
time: true # 文章阅读时长
total_symbols: true # 站点总字数统计
total_time: true # 站点总阅读时长
exclude_codeblock: false # 排除代码字数统计
可以调整
主题配置文件:
# Post wordcount display settings
# Dependencies: https://github.com/theme-next/hexo-symbols-count-time
symbols_count_time:
separated_meta: true # 是否换行显示 字数统计 及 阅读时长
item_text_post: true # 文章 字数统计 阅读时长 使用图标 还是 文本表示
item_text_total: true # 博客底部统计 字数统计 阅读时长 使用图标 还是 文本表示
awl: 4
wpm: 275
对应词条翻译
对上述词条翻译找了好久,终于摸索出来了,在此贡献给大家,在zh-Hans.yml中加入:
post:
views: 阅读次数
symbols_count_time:
time: 阅读时长
count: 本文字数
count_total: 站点总字数
time_total: 站点阅读时长