Hexo uses the Abbrlink plugin to generate article fixed number links

This article describes how to use the Abbrlink plugin to generate fixed numbered links to Hexo articles in the form http://id.github.io/posts/38175.htmlof .

The default static urlformat is: :year/:month/:day/:title, that is, the fixed link is generated according to the year, month, day, and article title. Such as: http://id.github.io/2022/11/23/hello-world.

Using the Abbrlink plug-in can make each article have a unique number, and use this number to uniquely distinguish the link of the article, so that there will be no Chinese in the link, and the link will not be changed due to the date of modifying the article.

First, let's install the plugin, open the command line in the root directory of the blog, and enter the following command:

npm install hexo-abbrlink --save

Modify _config.ymlthe file , modify permalink:the configuration items in the file, and add a configuration item abbrlink:. The modified results are as follows:

permalink: posts/:abbrlink.html  # 此处可以自己设置,也可以直接使用 /:abbrlink.html
abbrlink:
    alg: crc16   #算法:crc16(default) and crc32
    rep: dec     #进制:dec(default) and hex

Among them, algthe attribute indicates the algorithm, currently supports crc16and crc32algorithms, and the default value is crc16. repRepresentation, that is, the generated link can be in hexadecimal format or decimal format. The default value is in decimal format. Examples are as follows:

crc16 & hex
https://id.github.io/posts/3ab8.html
crc16 & dec
https://id.github.io/posts/28591.html

crc32 & hex
https://id.github.io/posts/23ab1cd3.html
crc32 & dec
https://id.github.io/posts/5471416323.html

Note: Algorithms and forms must be changed before generation, otherwise changes will result in inconsistent links.

Guess you like

Origin blog.csdn.net/m0_51755720/article/details/127996199