Skip to content

Commit cbe9103

Browse files
committed
meta information
1 parent 8b46fd2 commit cbe9103

File tree

1 file changed

+95
-37
lines changed

1 file changed

+95
-37
lines changed

rfcs/001.blog-plugin.md

Lines changed: 95 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,26 @@ We can specify a pagination through following interface:
2727
module.exports = {
2828
themeConfig: {
2929
pagination: {
30-
postsFilter(postA, index) {
30+
postsFilter (postA, index) {
3131
// default: Array.prototype.filter
3232
},
33-
postsSorter(postA, postB) {
33+
postsSorter (postA, postB) {
3434
// default: Array.prototype.sort
3535
},
36+
formatUrl (index) {
37+
// default: index => `page/${index}/`
38+
},
3639
postsPerPage: 10,
3740
layout: 'Pagination',
3841
},
3942
}
4043
}
4144
```
4245

46+
- `/page/1/` (same with `/`)
47+
- `/page/2/`
48+
- ......
49+
4350
## Tags
4451

4552
```md
@@ -50,11 +57,19 @@ tags:
5057
---
5158
```
5259

53-
And there are pages automatically generated:
60+
```js
61+
module.exports = {
62+
themeConfig: {
63+
tagUrl: 'tags' // default
64+
}
65+
}
66+
```
5467

55-
- /tags/
56-
- /tags/foo/
57-
- /tags/bar/
68+
- `/tags/`
69+
- `/tags/foo/`
70+
- `/tags/bar/`
71+
- `/tags/bar/page/2/`
72+
- ......
5873

5974
## Catrgories
6075

@@ -64,58 +79,101 @@ category: cat
6479
---
6580
```
6681

67-
And there are pages automatically generated:
82+
```js
83+
module.exports = {
84+
themeConfig: {
85+
categoryUrl: 'categories' // default
86+
}
87+
}
88+
```
6889

69-
- /categories/
70-
- /categories/cat/
90+
- `/categories/`
91+
- `/categories/cat/`
92+
- `/categories/dog/`
93+
- `/categories/dog/page/2/`
94+
- ......
7195

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

74-
## Drafting
98+
## Authoring
7599

76-
```md
77-
---
78-
draft: true
79-
---
80-
```
100+
### With Only One Author
81101

82-
And this page will only be rendered with dev mode.
102+
```js
103+
module.exports = {
104+
themeConfig: {
105+
authors: {
106+
nickname: 'Shigma',
107+
description: 'Hello VuePress',
108+
email: '<email>',
109+
location: '<location>',
110+
organization: '<organization>',
111+
avatar: '<avatar>',
112+
sns: {
113+
github: 'https://github.com/Shigma',
114+
// and more
115+
},
116+
},
117+
}
118+
}
119+
```
83120

84-
## Authoring
121+
### With Mulitple Authors
85122

86123
```md
87124
---
88-
author: Shigma
125+
author: shigma
126+
contributors:
127+
- ulivz
89128
---
90129
```
91130

92131
```js
93132
module.exports = {
94133
themeConfig: {
95134
authors: [
96-
{
97-
nickname: 'Shigma',
98-
description: 'Hello VuePress',
99-
email: '<email>',
100-
location: '<location>',
101-
organization: '<organization>',
102-
avatar: '<avatar>',
103-
sns: {
104-
github: 'https://github.com/Shigma',
105-
// and more
106-
},
107-
// and more
108-
},
109-
// and more
110-
]
135+
{ /* one author */ },
136+
{ /* another author */ },
137+
],
138+
authorsUrl: 'authors' // default
111139
}
112140
}
113141
```
114142

115-
And there are pages automatically generated if there are more than one authors:
143+
If there are more than one authors:
144+
145+
- `/authors/`
146+
- `/authors/shigma/`
147+
- `/authors/ulivz/`
148+
- `/authors/ulivz/page/2/`
149+
- ......
150+
151+
## Drafting
152+
153+
```md
154+
---
155+
draft: true
156+
---
157+
```
158+
159+
And this page will only be rendered under dev mode.
160+
161+
## Meta Information
116162

117-
- /authors/
118-
- /authors/Shigma/
163+
And meta information can be accessed by computed properties:
164+
165+
```js
166+
const {
167+
created,
168+
updated,
169+
author,
170+
contributors,
171+
} = this.$page
172+
```
173+
174+
## Git Workflow
175+
176+
With the aid of `@vuepress/plugin-git-log` (in another RFC), VuePress can automatically generate some meta-informations, including `author`, `contributors`, `created` and `updated`.
119177

120178
## Directory-level Configuration
121179

@@ -141,7 +199,7 @@ module.exports = {
141199

142200
# Drawbacks
143201

144-
N/A
202+
145203

146204
# Alternatives
147205

0 commit comments

Comments
 (0)