Skip to content

Commit

Permalink
feat($plugin-blog): add postsDir option (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy authored and ulivz committed Nov 13, 2018
1 parent 2256326 commit ecb1920
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/@vuepress/plugin-blog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = (options, ctx) => {
const { layoutComponentMap } = ctx
const {
pageEnhancers = [],
postsDir = '_posts',
categoryIndexPageUrl = '/category/',
tagIndexPageUrl = '/tag/',
permalink = '/:year/:month/:day/:slug'
Expand Down Expand Up @@ -40,7 +41,7 @@ module.exports = (options, ctx) => {
frontmatter: { layout: getLayout('Layout') }
},
{
when: ({ regularPath }) => regularPath.startsWith('/_posts/'),
when: ({ regularPath }) => regularPath.startsWith(`/${postsDir}/`),
frontmatter: {
layout: getLayout('Post', 'Page'),
permalink: permalink
Expand Down
5 changes: 5 additions & 0 deletions packages/docs/docs/plugin/official/plugin-blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ module.exports = {

## Options

### postsDir

- Type: `string`
- Default: `_posts`

### categoryIndexPageUrl

- Type: `string`
Expand Down
11 changes: 11 additions & 0 deletions packages/docs/docs/zh/plugin/official/plugin-blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ module.exports = {

## 选项

### postsDir

- 类型: `string`
- 默认值: `_posts`

### categoryIndexPageUrl

- 类型: `string`
Expand All @@ -33,3 +38,9 @@ module.exports = {
- 类型: `string`
- 默认值: `/tag/`

### permalink

- 类型: `string`
- 默认值: `/:year/:month/:day/:slug`

为博客文章设置永久链接。详情参考 [Permalinks](/zh/guide/permalinks.html#模板变量)

0 comments on commit ecb1920

Please sign in to comment.