目录
前言
Hexo文章链接默认的生成规则是::year/:month/:day/:title
,是按照年、月、日、标题来生成的。生成的链接非常长,如果标题中含中文的话,复制URL链接会转一大串编码字符。
此插件,不论你如何修改文章的日期、名称,只要不改变 footer-matter 中的 id 值,那么文章链接永远不会变。
一、插件链接
二、安装
npm install hexo-abbrlink --save
三、使用
- 修改
_config.yml
: - 这里2种写法都可
## permalink: :year/:month/:day/:title/
permalink: posts/:abbrlink/
## or
permalink: posts/:abbrlink.html
- 再加以下配置
## abbrlink config
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.
- 配置如图
- 其他配置意义可查看插件文档,链接在顶部