Hexo 创建文章生成的链接因为有中文而访问不到问题解决
Hexo 默认文章链接生成规则是按照年、月、日、标题来生成的。而我生成的链接访问不到文章,不知道你们有没有遇到这个问题.
- 接下来介绍一个插件
hexo-abbrlink
,该插件会为每篇生成一个唯一字符串,并不受文章标题和发布时间的影响 - hexo-abbrlink的源码链接
安装这个插件
npm install hexo-abbrlink --save
修改博客根目录配置文件_config.yml
的 permalink
# permalink: :year/:month/:day/:title/
permalink: lxb/:abbrlink.html # lxb 是自定义的前缀 这里是为了生成的文章链接不会因为有中文而访问不到
abbrlink:
alg: crc32 #算法: crc16(default) and crc32
rep: hex #进制: dec(default) and hex
这些算法啊进制啊,是可以选择的生成结果不同(了解一下就行),下面是我的配置
选择不同算法和进制生成不同的格式,下面举例:
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
欢迎访问我的博客:https://lxb-log.github.io