本文最后更新于:2023年12月5日 下午

本文介绍增加Next主题文章阅读数量和访客数量的方法。

不蒜子站点访客、文章阅读量

修改主题配置文件不蒜子enable的开关为true

1
2
3
4
5
6
7
8
9
10
# 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,执行命令:

1
2
hexo clean
hexo g

字符统计、阅读时间统计

启用 hexo-symbols-count-time ,官方Github链接,执行命令:

1
npm install hexo-symbols-count-time

站点配置文件加入:

1
2
3
4
5
6
symbols_count_time:
symbols: true # 文章字数统计
time: true # 文章阅读时长
total_symbols: true # 站点总字数统计
total_time: true # 站点总阅读时长
exclude_codeblock: false # 排除代码字数统计

可以调整主题配置文件

1
2
3
4
5
6
7
8
# 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中加入:

1
2
3
4
5
6
7
post:
views: 阅读次数
symbols_count_time:
time: 阅读时长
count: 本文字数
count_total: 站点总字数
time_total: 站点阅读时长



文章链接:
https://www.zywvvd.com/notes/hexo/theme/next/4-add-viewers/viewers/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

Next -4- 增加站点访客、文章阅读量、字符统计、阅读时间统计与对应词条翻译
https://www.zywvvd.com/notes/hexo/theme/next/4-add-viewers/viewers/
作者
Yiwei Zhang
发布于
2020年2月28日
许可协议