feat: WordCount

This commit is contained in:
沈宇
2020-01-07 14:05:02 +08:00
parent 758b378e82
commit ca99e5de86
9 changed files with 148 additions and 4 deletions

View File

@@ -12,6 +12,9 @@
<div class="article-meta">
<%- partial('post/date', {class_name: 'article-date', date_format: null}) %>
<%- partial('post/category') %>
<% if(theme.word_count && theme.word_count.enable && !post.no_word_count){%>
<%- partial('post/word') %>
<% } %>
</div>
<% } %>
@@ -32,10 +35,10 @@
<% } %>
<!-- 打赏 -->
<% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !index){ %>
<div id="reward-btn">
打赏
</div>
<% } %>
<div id="reward-btn">
打赏
</div>
<% } %>
</div>
<footer class="article-footer">
<a data-url="<%- post.permalink %>" data-id="<%= post._id %>"

View File

@@ -0,0 +1,22 @@
<% if (!theme.word_count.only_article_visit || (!index && theme.word_count.only_article_visit)){ %>
<div style="margin-top:10px;">
<span class="post-time">
<span class="post-meta-item-icon">
<!-- fonts.scss -->
<!-- 百度字体平台:http://fontstore.baidu.com/static/editor/index.html -->
<i class="icon-statistics"></i>
<span class="post-meta-item-text"> 字数统计:</span>
<span class="post-count"><%= wordcount(post.content) %>字</span>
</span>
</span>
<span class="post-time">
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
<i class="icon-book icon"></i>
<span class="post-meta-item-text"> 阅读时长≈</span>
<span class="post-count"><%= min2read(post.content) %>分</span>
</span>
</span>
</div>
<% } %>