Skip to content

Commit

Permalink
feat($plugin-blog): Allow the permalink for blog posts to be configur…
Browse files Browse the repository at this point in the history
…ed. (#997)
  • Loading branch information
seifertm authored and ulivz committed Nov 12, 2018
1 parent 7c61fcf commit 615006d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/@vuepress/plugin-blog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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' }
},
Expand Down
7 changes: 7 additions & 0 deletions packages/docs/docs/plugin/official/plugin-blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 615006d

Please sign in to comment.