1. Install the plug-in

npm uninstall hexo-generator-index --save
npm install hexo-generator-index-pin-top --save
Copy the code

If continuous deployment and continuous integration tools are enabled, these two lines need to be added to the automatic build script, as shown below:

2. Set the text at the top

Add to front-matter for articles that need to be toppedtop: trueFor example:



Regenerating the deployment looks like this, and you can see that the article has been placed at the top:

3. Add a top icon

Open the post.swig file in the /blog/themes/hexo-theme-next/layout/_macro directory and insert the following code into the

{% if post.top %}
  <i class="fa fa-thumb-tack"></i>
  <font color=7D26CD>Placed at the top</font>
  <span class="post-meta-divider">|</span>
{% endif %}
Copy the code

Regenerating the deployment looks like this:



For more exciting articles and resources, please pay attention to my wechat official number: “McUlover666”.