Skip to content

Commit

Permalink
directory-level configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Mar 6, 2019
1 parent f34b152 commit 8b46fd2
Showing 1 changed file with 28 additions and 37 deletions.
65 changes: 28 additions & 37 deletions rfcs/001.blog-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

# Summary

- a new `@vuepress/plugin-blog`, featured with tags, categories, drafting, pagination
- a `@vuepress/theme-plog`
- `@vuepress/plugin-blog`, featured with tags, categories, drafting, pagination
- `@vuepress/theme-plog`, featured with

# Basic example

See [detailed design](#detailed-design) section.

# Motivation

By popular demand, VuePress will provide some official blog supports, including a blog plugin and an atomic blog theme.
With popular demand, VuePress will provide some official blog supports, including a blog plugin and an atomic blog theme.

See: [#36](https://github.com/vuejs/vuepress/issues/36)

Expand All @@ -33,8 +33,8 @@ module.exports = {
postsSorter(postA, postB) {
// default: Array.prototype.sort
},
perPagePosts: 10,
layout: 'Layout',
postsPerPage: 10,
layout: 'Pagination',
},
}
}
Expand Down Expand Up @@ -69,24 +69,6 @@ And there are pages automatically generated:
- /categories/
- /categories/cat/

### specify via config

```js
module.exports = {
themeConfig: {
directories: [
{
path: 'dog',
category: 'dog',
layout: 'DogLayout',
}
]
}
}
```

### prev/next pages

If a post has its category, its previous/next page will be posts next to it under the same category.

## Drafting
Expand All @@ -97,20 +79,7 @@ draft: true
---
```

And this page will only be rendered with dev mode. Drafting can also be specified via config:

```js
module.exports = {
themeConfig: {
directories: [
{
path: '_draft',
draft: true,
}
]
}
}
```
And this page will only be rendered with dev mode.

## Authoring

Expand Down Expand Up @@ -148,6 +117,28 @@ And there are pages automatically generated if there are more than one authors:
- /authors/
- /authors/Shigma/

## Directory-level Configuration

Drafting can also be specified via config:

```js
module.exports = {
themeConfig: {
directories: [
{
path: '_draft',
draft: true,
},
{
path: 'cat',
category: 'cat',
layout: 'CatLayout',
},
]
}
}
```

# Drawbacks

N/A
Expand Down

1 comment on commit 8b46fd2

@oovm
Copy link

@oovm oovm commented on 8b46fd2 Mar 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The system needs to override unique options and combine non-unique options.

Consider the following structure:

-- dirA( category: C1, tags:[t1] )
 |-- text1.md
 |-- dirB ( category: C2, tags:[t2] )
   |-- text2.md

so text1.md should have (category: C1, tags:[t1]) as default while text1.md should have (category: C2, tags:[t1,t2]).

Please sign in to comment.