You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rfcs/001.blog-plugin.md
+95-37Lines changed: 95 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -27,19 +27,26 @@ We can specify a pagination through following interface:
27
27
module.exports= {
28
28
themeConfig: {
29
29
pagination: {
30
-
postsFilter(postA, index) {
30
+
postsFilter(postA, index) {
31
31
// default: Array.prototype.filter
32
32
},
33
-
postsSorter(postA, postB) {
33
+
postsSorter(postA, postB) {
34
34
// default: Array.prototype.sort
35
35
},
36
+
formatUrl (index) {
37
+
// default: index => `page/${index}/`
38
+
},
36
39
postsPerPage:10,
37
40
layout:'Pagination',
38
41
},
39
42
}
40
43
}
41
44
```
42
45
46
+
-`/page/1/` (same with `/`)
47
+
-`/page/2/`
48
+
- ......
49
+
43
50
## Tags
44
51
45
52
```md
@@ -50,11 +57,19 @@ tags:
50
57
---
51
58
```
52
59
53
-
And there are pages automatically generated:
60
+
```js
61
+
module.exports= {
62
+
themeConfig: {
63
+
tagUrl:'tags'// default
64
+
}
65
+
}
66
+
```
54
67
55
-
- /tags/
56
-
- /tags/foo/
57
-
- /tags/bar/
68
+
-`/tags/`
69
+
-`/tags/foo/`
70
+
-`/tags/bar/`
71
+
-`/tags/bar/page/2/`
72
+
- ......
58
73
59
74
## Catrgories
60
75
@@ -64,58 +79,101 @@ category: cat
64
79
---
65
80
```
66
81
67
-
And there are pages automatically generated:
82
+
```js
83
+
module.exports= {
84
+
themeConfig: {
85
+
categoryUrl:'categories'// default
86
+
}
87
+
}
88
+
```
68
89
69
-
- /categories/
70
-
- /categories/cat/
90
+
-`/categories/`
91
+
-`/categories/cat/`
92
+
-`/categories/dog/`
93
+
-`/categories/dog/page/2/`
94
+
- ......
71
95
72
96
If a post has its category, its previous/next page will be posts next to it under the same category.
73
97
74
-
## Drafting
98
+
## Authoring
75
99
76
-
```md
77
-
---
78
-
draft: true
79
-
---
80
-
```
100
+
### With Only One Author
81
101
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
+
```
83
120
84
-
##Authoring
121
+
### With Mulitple Authors
85
122
86
123
```md
87
124
---
88
-
author: Shigma
125
+
author: shigma
126
+
contributors:
127
+
- ulivz
89
128
---
90
129
```
91
130
92
131
```js
93
132
module.exports= {
94
133
themeConfig: {
95
134
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
111
139
}
112
140
}
113
141
```
114
142
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
116
162
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`.
0 commit comments