• 为什么会修改文章默认的链接原因是:默认有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插件官方地址