When Hexo (sakura) article to add a word count and read long features

First, the article adds length and word count function when reading

1. Installation hexo-wordcount

First install the relevant plug-in terminal enter the following command:

npm install hexo-wordcount --save

2. configuration file (step 3)

2.1 theme\sakura\layout\_partial\created underword.ejsFile (display style):

	<div style="margin-top:10px;">
	    <span class="post-time">
	      <span class="post-meta-item-icon">
	        <i class="fa fa-keyboard-o"></i>
	        <span class="post-meta-item-text">  字数统计: </span>
	        <!-- 安装插件npm install hexo-wordcount --save -->
	        <span class="post-count"><%= wordcount(post.content) %>字</span>
	      </span>
	    </span>
	
	    <span class="post-time">
	      &nbsp; | &nbsp;
	      <span class="post-meta-item-icon">
	        <i class="fa fa-hourglass-half"></i>
	        <span class="post-meta-item-text">  阅读时长: </span>
	        <span class="post-count"><%= min2read(post.content) %>分</span>
	      </span>
	    </span>
	</div>

2.2\themes\sakura\layout\_widget\common-article.ejsTitle of the article in place to add :( added </head>before the tag)

		  <!-- 开始添加字数统计-->
	      <% if(theme.word_count && !post.no_word_count){%>
	        <%- partial('_partial/word') %>
	      <% } %>
	      <!-- 添加完成 -->

2.3 In MyWeb\themes\sakura\_config.ymlthe end of the configuration file to add:

	# 是否开启字数统计
	#不需要使用,直接设置值为false,或注释掉
	word_count: true
  1. Operating results shown in the picture
    Here Insert Picture Description

Second, the restoration of the picture and link display problems

Here Insert Picture Description
When _post directory md write the article, author information should be added:
author(名称),authorLink(链接),avatar(头像),authorAbout(简介)

---
title: 2020年2月4日情人节随笔
author: cungudafa
authorLink: https://cungudafa.gitee.io
avatar: https://cdn.jsdelivr.net/gh/cungudafa/cdn/img/custom/cungudafa.jpg
authorAbout: 姑,一个学习记录者
date: 2020-02-13 22:59:10
tag: 随笔
categories: 生活
comment: true
description: 
photos: 
---

in\themes\sakura\layout\_widget\common-article.ejsTitle of the article can be modified style:

Here Insert Picture Description
Here Insert Picture Description

Published 203 original articles · won praise 352 · views 130 000 +

Guess you like

Origin blog.csdn.net/cungudafa/article/details/104308312