Hexo 文章计数插件 WordCount

灵感来自简书

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

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

npm

npm

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

安装和使用

安装

npm i --save hexo-wordcount

使用

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

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

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

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

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


A Word Count plugin for Hexo.

Installation

Install

npm install hexo-wordcount --save

Usage

Swig

Post Count:

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

Total Count:

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

Ejs

Post Count:

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

Total Count:

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

Jade

Post Count:

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

Total Count:

   span.post-count= totalcount(site)

LICENSE

MIT

The End