From 5efa97d7a256d087c630023cb0890b36dd7baa61 Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Sun, 11 Nov 2018 10:01:42 +0100 Subject: [PATCH] feat($plugin-blog): Allow the permalink for blog posts to be configured. --- packages/@vuepress/plugin-blog/index.js | 5 +++-- packages/docs/docs/plugin/official/plugin-blog.md | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) 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.