Bing - 每日壁纸
260 字
1 分钟
Hexo永久链接优化
使用hexo博客时,访问文章的默认链接看起来十分杂乱,使用hexo-abbrlink插件可以完美解决这一痛点
Waiting for api.github.com...
食用教程
-
安装插件

Terminal window #安装插件npm install hexo-abbrlink --save --registry=https://registry.npmmirror.com -
配置链接格式
打开 hexo根目录/_config.yml
修改permalink为如下内容,二选一即可
#结尾无.htmlposts/:abbrlink/#结尾有.htmlposts/:abbrlink.html
-
插件配置
在当前配置文件中添加如下代码
# hexo-abbrlinkabbrlink:alg: crc16 #支持crc16和crc32算法(默认crc16)rep: hex #支持dec和hex值(默认dec)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 > 0auto_category:enable: true #true(default)depth: #3(default)over_write: falseauto_title: false #enable auto title, it can auto fill the title by pathauto_date: false #enable auto date, it can auto fill the date by time todayforce: 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.
通过配置alg和rep参数可以改变链接大小,如下
#crc16 & hexhttps://example.com/posts/64c8.html# crc16 & dechttps://example.com/posts/67535.html# crc32 & hexhttps://example.com/posts/8dff18eb.html# crc32 & dechttps://example.com/posts/1690092958.html
支持与分享
如果这篇文章对你有帮助,欢迎分享给更多人或赞助支持!
最后更新于 2024-08-25,距今已过 534 天
部分内容可能已过时
喜之梁