前言
HEXO默认的文章链接格式是
year/:month/:day/:title/这样子链接生成出来是https://seln.cn/2023/01/25/jc/markdown/
这样的链接很长,而且改一次标题他就会随着改变,链接也失效了
安装插件
在博客根目录用git bash安装以下插件
npm install hexo-abbrlink --save安装完成后,打开博客根目录下的_config.yml,修改以下配置:
permalink: posts/:abbrlink/ # 此处可以自己设置,也可以直接使用 :abbrlink/
permalink_defaults:
abbrlink:
alg: crc32 #算法: crc16(default) and crc32
rep: hex #进制: dec(default) and hex
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks我这种是域名/文件夹/文章的方法,例seln.cn/posts/e7f6bd97
你也可以设置成permalink: /:abbrlink/,链接就会变成这样seln.cn/abcd/
接下来hexo 三连即可看到成品
hexo cl;hexo g;hexo d
或者
hexo cl;hexo g;hexo s
评论