有的时候,写好一篇文章,想要置顶,但 next 默认是按照时间来进行排序的,自己写的文章总不能靠修改创作时间来进行置顶吧。想要通过一个权重来进行排序,但苦苦没有办法,今天它来了
设置文章置顶
- 修改仓库配置,使其支持文章置顶功能
卸载 hexo-generator-index
1 | npm r hexo-generator-index |
安装 hexo-generator-index-pin-top
1 | npm i hexo-generator-index-pin-top -S |
- 在文章中添加置顶信息
添加 top
1 | title: 文章置顶 |
top 后数字越大,权限越高
添加置顶标志
打开:/bolg/themes/next/layout/_macro/post.swig 文件
在<span class='post-time'>
标签下,插入以下代码:
1 | {% if post.top %} |