add wordcount, time to read

This commit is contained in:
FoxerLee 2020-08-12 22:14:33 -04:00
parent 85b9f5769c
commit 438c484d77
5 changed files with 32 additions and 4 deletions

View File

@ -67,12 +67,12 @@
- [x] 页面滚动百分比提示。
- [x] 一键快速回到顶部。
- [x] 无 jQuery代码精简。
- [x] 文章字数统计
- [x] 文章阅读时长
### Unfinished 未完成
- [ ] 文章版权信息
- [ ] 文章字数统计
- [ ] 文章阅读时长
- [ ] 文章支持显示公式
- [ ] 在线更改字体和字号
- [ ] 打赏功能
@ -237,6 +237,14 @@ magic:
enable: false # 是否显示侧边栏
fixed: true # 侧边栏是否固定
position: right # 侧边栏位置 values: left | right
# 文章字数统计、阅读时长
# 需要安装 https://github.com/willin/hexo-wordcount
# npm i --save hexo-wordcount
post_wordcount:
wordcount: true # 字数统计
min2read: true # 阅读时长
```
### Comment 评论

View File

@ -99,3 +99,9 @@ magic:
enable: false
fixed: true
position: right # values: left | right
# Post wordcount display settings
# Dependencies: https://github.com/willin/hexo-wordcount
post_wordcount:
wordcount: true # word count, one article
min2read: true # time to read, one article

View File

@ -23,3 +23,5 @@ site_pv: PV
links: Links
top: TOP
read_more: Read more
wordcount: Words
min2read: Mins

View File

@ -23,3 +23,5 @@ site_pv: 总访问量
links: 友链
top: 顶置
read_more: 阅读全文
wordcount:
min2read: 分钟

View File

@ -31,4 +31,14 @@
<i class="fa fa-eye"></i> <span id="busuanzi_value_page_pv"></span>
</span>
<% } %>
<% if(theme.post_wordcount.wordcount){ %>
<span class="post-count article-wc article-meta-item">
<i class="fa fa-book"></i> <span ><%= wordcount(page.content) %> <%- __('wordcount') %></span>
</span>
<% } %>
<% if(theme.post_wordcount.min2read){ %>
<span class="post-count article-mr article-meta-item">
<i class="fa fa-clock-o"></i> <span ><%= min2read(page.content) %> <%- __('min2read') %></span>
</span>
<% } %>
</div>