Skip to content

Commit

Permalink
add wordcount support
Browse files Browse the repository at this point in the history
  • Loading branch information
francisXKF committed May 12, 2018
1 parent 51d8af5 commit d990a41
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion _config.yml
Expand Up @@ -39,6 +39,7 @@ show_category_count: false ## If you want to show the count of categories in the
toc_number: true ## If you want to add list number to toc please set the value to true.
shareto: false ## If you want to use the share button please set the value to true, you must have hexo-helper-qrcode installed.
busuanzi: false ## If you want to use Busuanzi page views please set the value to true.
wordcount: false ## If you want to use wordcount views please set the value to true, and make sure that hexo-wordcount is installed
widgets_on_small_screens: false ## Set to true to enable widgets on small screens.
canvas_nest:
enable: false ## If you want to use dynamic background please set the value to true, you can also fill the following parameters to customize the dynamic effect, or just leave them blank to keep the default effect.
Expand All @@ -58,7 +59,7 @@ post_copyright:
enable: false ## If you want to display the copyright info after each post, please set the value to true and fill the following items on your need.
author: ## Your author name, e.g. tufu9441
copyright_text: ## Your copyright text, e.g. The author owns the copyright, please indicate the source reproduced.

menu:
- page: home
directory: .
Expand Down
2 changes: 2 additions & 0 deletions languages/en.yml
Expand Up @@ -27,3 +27,5 @@ copyright_author_prefix: "Author: "
copyright_link_prefix: "Blog Link: "
copyright_declare_prefix: "Copyright Declaration: "
copyright_default_text: "The author owns the copyright. Please indicate the source reproduced!"
word_cnt: Words
read_time: Minutes
2 changes: 2 additions & 0 deletions languages/zh-CN.yml
Expand Up @@ -27,3 +27,5 @@ copyright_author_prefix: 本文作者:
copyright_link_prefix: 本文链接:
copyright_declare_prefix: 版权声明:
copyright_default_text: 本博客所有文章除特别声明外,均采用 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0 CN</a> 许可协议。转载请注明出处!
word_cnt:
read_time: 分钟
11 changes: 11 additions & 0 deletions layout/_partial/wordcount.pug
@@ -0,0 +1,11 @@
span.post-time
span.post-meta-item-text= ' | '
span.post-meta-item-icon
i(class="fa fa-keyboard-o")
span.post-count= ' '+wordcount(page.content)
span.post-meta-item-text= " "+__('word_cnt')
span.post-time= ' | '
span.post-meta-item-icon
i(class="fa fa-hourglass-half")
span.post-count= ' '+min2read(page.content)
span.post-meta-item-text= ' '+__('read_time')
2 changes: 2 additions & 0 deletions layout/post.pug
Expand Up @@ -17,6 +17,8 @@ block content
span#busuanzi_container_page_pv= ' | '
span#busuanzi_value_page_pv
span= ' ' + __('Hits')
if theme.wordcount == true
include _partial/wordcount.pug
if theme.disqus
a.disqus-comment-count(data-disqus-identifier=page.path, href=url_for(page.path) + '#disqus_thread')
if theme.changyan
Expand Down

0 comments on commit d990a41

Please sign in to comment.