Hexo-next主题设置abbrlink插件生成永久链接

安装abbrlink插件

1
npm install hexo-abbrlink --save

配置 - 修改_config.yml配置文

1
2
3
#permalink: :year/:month/:day/:title/   #此处是默认,注释掉
#permalink_defaults: #此处是默认,也注释掉
permalink: posts/:abbrlink.html # 使用此处代替,也可以直接使用 :/abbrlink

修改_config.next.yml配置文件,在尾部添加以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
## abbrlink config
abbrlink:
alg: crc32 #support crc16(default) and crc32 进制
rep: hex #support dec(default) and hex 算法
drafts: false #(true)Process draft,(false)Do not process draft. false(default)
## Generate categories from directory-tree
## depth: the max_depth of directory-tree you want to generate, should > 0
auto_category:
enable: true #true(default)
depth: #3(default)
over_write: false
auto_title: false #enable auto title, it can auto fill the title by path
auto_date: false #enable auto date, it can auto fill the date by time today
force: false #enable force mode,in this mode, the plugin will ignore the cache, and calc the abbrlink for every post even it already had abbrlink.

然后运行以下代码测试效果

1
hexo clean && hexo g && hexo s

没问题的话就使用以下代码部署

1
hexo clean && hexo g && hexo d