Hexo文章计数插件WordCount

灵感来自简书

字数统计的结果跟简书有差异,主要是由于本插件只统计了中文字数和英文单词数,所以结果会比简书统计的字数略少一些。

特别适合文字爱好者,比如我。

npm

npm

项目地址: https://npmjs.org/package/hexo-wordcount

安装和使用

安装

1
npm i --save hexo-wordcount

使用

修改Themes模板文件,在Post文章模板区域加入:

1
<span class="post-count">{{ wordcount(post.content) }}</span>

即可统计单篇文章的字数。

1
<span class="post-count">{{ totalcount(site) }}</span>

上面这句是统计总字数的,可以放到Footer或其他位置里。


A Word Count plugin for Hexo.

Installation

Install

1
npm install hexo-wordcount --save

Usage

Swig

Post Count:

1
<span class="post-count">{{ wordcount(post.content) }}</span>

Total Count:

1
<span class="post-count">{{ totalcount(site) }}</span>

Ejs

Post Count:

1
<span class="post-count"><%= wordcount(post.content) %></span>

Total Count:

1
<span class="post-count"><%= totalcount(site) %></span>

Jade

Post Count:

1
span.post-count= wordcount(post.content)

Total Count:

1
span.post-count= totalcount(site)

LICENSE

MIT

便于鸣谢,捐赠请留下网名~