Merge pull request #12 from FoxerLee/master

feat: add wordcount & time to read
This commit is contained in:
指间的诗意 2020-08-13 11:11:49 +08:00 committed by GitHub
commit 2fa62e812c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 4 deletions

View File

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

View File

@ -99,3 +99,9 @@ magic:
enable: false enable: false
fixed: true fixed: true
position: right # values: left | right 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 links: Links
top: TOP top: TOP
read_more: Read more read_more: Read more
wordcount: Words
min2read: Mins

View File

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

View File

@ -31,4 +31,14 @@
<i class="fa fa-eye"></i> <span id="busuanzi_value_page_pv"></span> <i class="fa fa-eye"></i> <span id="busuanzi_value_page_pv"></span>
</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> </div>