diff --git a/packages/@vuepress/plugin-blog/index.js b/packages/@vuepress/plugin-blog/index.js index 00af3f6088..e02dc10430 100644 --- a/packages/@vuepress/plugin-blog/index.js +++ b/packages/@vuepress/plugin-blog/index.js @@ -5,7 +5,8 @@ module.exports = (options, ctx) => { const { pageEnhancers = [], categoryIndexPageUrl = '/category/', - tagIndexPageUrl = '/tag/' + tagIndexPageUrl = '/tag/', + permalink = '/:year/:month/:day/:slug' } = options const isLayoutExists = name => layoutComponentMap[name] !== undefined @@ -42,7 +43,7 @@ module.exports = (options, ctx) => { when: ({ regularPath }) => regularPath.startsWith('/_posts/'), frontmatter: { layout: getLayout('Post', 'Page'), - permalink: '/:year/:month/:day/:slug' + permalink: permalink }, data: { type: 'post' } }, diff --git a/packages/docs/docs/plugin/official/plugin-blog.md b/packages/docs/docs/plugin/official/plugin-blog.md index 2d592ae17a..bca2ec1593 100644 --- a/packages/docs/docs/plugin/official/plugin-blog.md +++ b/packages/docs/docs/plugin/official/plugin-blog.md @@ -32,3 +32,10 @@ module.exports = { - Type: `string` - Default: `/tag/` + +### permalink + +- Type: `string` +- Default: `/:year/:month/:day/:slug` + +Configures the permalink generated for blog posts. See [Permalinks](/guide/permalinks.html#template-variables) for a list of valid variables.