Skip to content

Commit 615006d

Browse files
seifertmulivz
authored andcommitted
feat($plugin-blog): Allow the permalink for blog posts to be configured. (#997)
1 parent 7c61fcf commit 615006d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/@vuepress/plugin-blog/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports = (options, ctx) => {
55
const {
66
pageEnhancers = [],
77
categoryIndexPageUrl = '/category/',
8-
tagIndexPageUrl = '/tag/'
8+
tagIndexPageUrl = '/tag/',
9+
permalink = '/:year/:month/:day/:slug'
910
} = options
1011

1112
const isLayoutExists = name => layoutComponentMap[name] !== undefined
@@ -42,7 +43,7 @@ module.exports = (options, ctx) => {
4243
when: ({ regularPath }) => regularPath.startsWith('/_posts/'),
4344
frontmatter: {
4445
layout: getLayout('Post', 'Page'),
45-
permalink: '/:year/:month/:day/:slug'
46+
permalink: permalink
4647
},
4748
data: { type: 'post' }
4849
},

packages/docs/docs/plugin/official/plugin-blog.md

+7
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ module.exports = {
3232

3333
- Type: `string`
3434
- Default: `/tag/`
35+
36+
### permalink
37+
38+
- Type: `string`
39+
- Default: `/:year/:month/:day/:slug`
40+
41+
Configures the permalink generated for blog posts. See [Permalinks](/guide/permalinks.html#template-variables) for a list of valid variables.

0 commit comments

Comments
 (0)