Hexo添加字数统计和阅读统计

Hexo博客添加字数统计和阅读统计

  1. 安装hexo-wordcount插件
npm i --save hexo-wordcount

成功会在根目录下的package.json中多出"hexo-wordcount": "^6.0.1"

  1. 安装hexo-symbols-count-time
$ npm install hexo-symbols-count-time --save
  1. 安装eslint
$ npm install eslint --save
  1. 在站点配置文件添加如下配置
symbols_count_time:
  symbols: true                # 文章字数统计
  time: true                   # 文章阅读时长
  total_symbols: true          # 站点总字数统计
  total_time: true             # 站点总阅读时长
  exclude_codeblock: false     # 排除代码字数统计
  1. 在主题配置文件中添加如下配置
symbols_count_time:
  separated_meta: true     # 是否另起一行(true的话不和发表时间等同一行)
  item_text_post: true     # 首页文章统计数量前是否显示文字描述(本文字数、阅读时长)
  item_text_total: false   # 页面底部统计数量前是否显示文字描述(站点总字数、站点阅读时长)
  awl: 4                   # Average Word Length
  wpm: 275                 # Words Per Minute(每分钟阅读词数)
  suffix: mins.

Next主题添加字数统计和阅读统计

在主题配置文件做如下更改

post_wordcount: 		# 字数统计
  item_text: true		# 是否显示文字
  wordcount: true		# 显示字数
  min2read: true		# 显示阅读时间
  totalcount: true		# 显示总数
  separated_meta: true	# 是否分开

大功告成啦!

猜你喜欢

转载自blog.csdn.net/qq_44082148/article/details/105701427