Hexo博客使用静态链接

hexo-静态链接

一个基于帖子标题生成静态帖子链接的Hexo插件。

开始安装

添加插件到 HEXO 中,执行以下命令行安装:

1
2
npm install hexo-abbrlink --save

在 config.yml 文件中配置以下信息:

1
2
permalink: posts/:abbrlink/

有以下两种设置:

1
2
3
alg -- Algorithm (currently support crc16 and crc32, which crc16 is default)
rep -- Represent (the generated link could be presented in hex or dec value)

示列

1
2
3
4
5
# abbrlink config
abbrlink:
alg: crc32 #support crc16(default) and crc32
rep: hex #support dec(default) and hex

样品

不同配置的链接效果如下:

1
2
3
4
5
6
7
8
9
10
11
12
crc16 & hex
https://post.zz173.com/posts/66c8.html

crc16 & dec
https://post.zz173.com/posts/65535.html

crc32 & hex
https://post.zz173.com/posts/8ddf18fb.html

crc32 & dec
https://post.zz173.com/posts/1690090958.html

局限性

crc16 的最大帖子数是 65535 但是对于个人博客网站,这个也不错了

感谢

NoahDragon