vuepress-plugin-shortlink
A vuepress plugin for generate static post link based on post file name.
安装
1npm install vuepress-plugin-shortlink --save
从 config.js 配置中删除 permalink,该插件是基于默认永久链接/:regular
例子
version 1.0
1source: /books/a-book.md
2permalink: /books/261f97f7.html
3
4source: /hello-word.md
5permalink: /b1d4025b.html
6
7source: /books/computer/a-book.md
8permalink: /books/computer/261f97f7.html
设定参数
该插件基于 vuepress-plugin-clean-urls,可以自定义后缀和 404,设定方法同 vuepress-plugin-clean-urls
1plugins: [
2 [
3 'vuepress-plugin-shortlink',
4 {
5 normalSuffix: '/',
6 indexSuffix: '/',
7 notFoundPath: '/404.html'
8 },
9 ],
10 ],
version 1.1
增加配置 containDirs
可设定只当文件夹全路径,其余只保留文件路径
1plugins: [
2 [
3 'vuepress-plugin-shortlink',
4 {
5 normalSuffix: '/',
6 indexSuffix: '/',
7 notFoundPath: '/404.html',
8 containDirs: ['/books']
9 },
10 ],
11 ],
地址展示
1source: /books/a-book.md
2permalink: /books/261f97f7/
3
4source: /hello-word.md
5permalink: /b1d4025b/
6
7source: /say/hello-word.md
8permalink: /b1d4025b/
9
10source: /books/computer/a-book.md
11permalink: 261f97f7/
ThanksFor
关注 “AUTRE” 微信公众号,给我留言