Hexo - Next 加入字数统计

一、安装

  1. 安装Npm包:npm install hexo-word-counter
  2. 一键三联:
    • hexo clean
    • hexo g
    • hexo server || hexo deploy

二、配置

  1. Hexo主题配置文件_config中配置如下:根据自己需要进行修改(官方设置在Hexo根目录添加配置,但是实验之后会发现失效情况,时间会显示NaN:aN)
  • awl – Average Word Length (chars count in word). Default: 4. You can check this here.
    • CN ≈ 2
    • EN ≈ 5
    • RU ≈ 6
  • wpm – Words Per Minute. Default: 275. You can check this here.
    • Slow ≈ 200
    • Normal ≈ 275
    • Fast ≈ 350

Note for Chinese users: because in Chinese language average word length about ~1.5 and if you at most cases write posts in Chinese (without mixed English), recommended to set awl to 2 and wpm to 300.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 文章字数统计设置  Post wordcount display settings
# Dependencies: https://github.com/next-theme/hexo-word-counter
# 字数统计
symbols_count_time:
# 设置
separated_meta: true #显示属性名称,设为false后只显示图标和统计数字,不显示属性的文字
item_text_post: true #显示属性名称,设为false后只显示图标和统计数字,不显示属性的文字
item_text_total: true #底部footer是否显示字数统计属性文字(如站点总字数,站点阅读时长 1 分钟)
awl: 4 #计算字数的一个设置,没设置过
wpm: 275 #一分钟阅读的字数
#文章内是否显示
symbols: true
# 文章内时间
time: true
# 网页底部是否显示
total_symbols: true
# 总时间
total_time: true

item_text_total:效果如下

最终效果: