修改hexo博客文章固定连接为随机号

  • 为什么会修改文章默认的链接原因是:默认有title为链接地址,但是如果后面会更改文章title,那么有可能就成为了一个死链接;
  • 另一个原因就是,如果文章的title是一个很长的中文名,在浏览器里显示就不很友好了.

安装依赖工具

  • 在blog根目录下,安装hexo-abbrlink插件
npm install hexo-abbrlink --save

修改站点配置文件a

  • 打开站点配置文件_config.yml
  • 做如下配置:
permalink: posts/:abbrlink/ # 将原来文章的地址修改
# 并添加如下配置:
abbrlink:
alg: crc32 #support crc16(default) and crc32
rep: hex #support dec(default) and hex
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 > 0
auto_category:
enable: true #true(default)
depth: #3(default)
over_write: false
auto_title: false #enable auto title, it can auto fill the title by path
auto_date: false #enable auto date, it can auto fill the date by time today
force: 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. This only updates abbrlink rather than other front variables.
permalink_defaults:
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

hexo-abbrlink插件官方地址

posted @   嵚舟  阅读(28)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
点击右上角即可分享
微信分享提示