文章页面显示字数统计与阅读全文所需时间很常见,本文主要是介绍下jekyll中如何实现文章的字数统计与阅读全文所需时间统计. 具体效果可以看本文头部!
字数统计
{{ page.content | strip_html | strip_newlines | remove: " " | size }}
阅读时间
- 阅读速度:350wpm
{{ page.content | strip_html | strip_newlines | remove: " " | size | divided_by: 350 | plus: 1 }}
整合
<span>本文总共 {{ page.content | strip_html | strip_newlines | remove: " " | size }} 字 <b>·</b> 阅读全文大约需要 {{ page.content | strip_html | strip_newlines | remove: " " | size | divided_by: 350 | plus: 1 }} 分钟</span>