mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-09 05:16:23 +10:00
feat($plugin-blog): add postsDir option (#998)
This commit is contained in:
@@ -4,6 +4,7 @@ module.exports = (options, ctx) => {
|
||||
const { layoutComponentMap } = ctx
|
||||
const {
|
||||
pageEnhancers = [],
|
||||
postsDir = '_posts',
|
||||
categoryIndexPageUrl = '/category/',
|
||||
tagIndexPageUrl = '/tag/',
|
||||
permalink = '/:year/:month/:day/:slug'
|
||||
@@ -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
|
||||
|
||||
@@ -23,6 +23,11 @@ module.exports = {
|
||||
|
||||
## Options
|
||||
|
||||
### postsDir
|
||||
|
||||
- Type: `string`
|
||||
- Default: `_posts`
|
||||
|
||||
### categoryIndexPageUrl
|
||||
|
||||
- Type: `string`
|
||||
|
||||
@@ -23,6 +23,11 @@ module.exports = {
|
||||
|
||||
## 选项
|
||||
|
||||
### postsDir
|
||||
|
||||
- 类型: `string`
|
||||
- 默认值: `_posts`
|
||||
|
||||
### categoryIndexPageUrl
|
||||
|
||||
- 类型: `string`
|
||||
@@ -33,3 +38,9 @@ module.exports = {
|
||||
- 类型: `string`
|
||||
- 默认值: `/tag/`
|
||||
|
||||
### permalink
|
||||
|
||||
- 类型: `string`
|
||||
- 默认值: `/:year/:month/:day/:slug`
|
||||
|
||||
为博客文章设置永久链接。详情参考 [Permalinks](/zh/guide/permalinks.html#模板变量)。
|
||||
|
||||
Reference in New Issue
Block a user