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
{{ message }}
This repository was archived by the owner on May 13, 2024. It is now read-only.
// Please keep looking down to see the available options.
24
29
}
25
30
```
@@ -31,25 +36,22 @@ module.exports = {
31
36
`Document classifier` is a set of functions that can classify pages with the same characteristics. For a blog developer, the same characteristics may exist between different pages as follows:
32
37
33
38
- Pages put in a directory (e.g. `_post`)
34
-
- Pages containing the same specific frontmatter key value (e.g. `tag: js`).
39
+
- Pages containing the same specific frontmatter key value (e.g. `tag: js`).
35
40
36
-
Of course, both of them may be related to another common
41
+
Of course, both of them may be related to another common
37
42
requirement, `pagination`.
38
43
39
44
So, how to combine them skillfully? Next, let's take a look at how this plugin solve these problems.
40
45
41
-
42
46
### Directory Classifier
43
47
44
48
Directory Classifier, that classifies the source pages placed in a same directory.
In the `Tags` component, you can use `this.$tag.list` to get the tag list. The value would be like:
284
290
@@ -302,9 +308,9 @@ In the `Tags` component, you can use `this.$tag.list` to get the tag list. The v
302
308
]
303
309
```
304
310
305
-
In the `FrontmatterPagination` component, you can use `this.$pagination.pages` to get the matched pages in current tag
311
+
In the `FrontmatterPagination` component, you can use `this.$pagination.pages` to get the matched pages in current tag
306
312
classification:
307
-
313
+
308
314
- If you visit `/tag/vue/`, the `this.$pagination.pages` will be:
309
315
310
316
```json
@@ -322,7 +328,6 @@ classification:
322
328
]
323
329
```
324
330
325
-
326
331
## Examples
327
332
328
333
Actually, there are only 2 necessary layout components to create a blog theme:
@@ -332,17 +337,3 @@ Actually, there are only 2 necessary layout components to create a blog theme:
332
337
- Tag (Only required when you set up a `tag` frontmatter classification.)
333
338
334
339
Here is [live example](https://github.com/ulivz/70-lines-of-vuepress-blog-theme) that implements a functionally qualified VuePress theme in around 70 lines.
Create one or more [directory classifiers](../README.md#directory-classifier), all available options in
13
+
`DirectoryClassifier` are as
14
+
follows.
15
+
16
+
### id
17
+
18
+
- Type: `string`
19
+
- Default: `undefined`
20
+
- Required: `true`
21
+
22
+
Unique id for current classifier, e.g. `post`.
23
+
24
+
### dirname
25
+
26
+
- Type: `string`
27
+
- Default: `undefined`
28
+
- Required: `true`
29
+
30
+
Matched directory name, e.g. `_post`.
31
+
32
+
### path
33
+
34
+
- Type: `string`
35
+
- Default: `/${id}/`
36
+
- Required: `false`
37
+
38
+
Entry page for current classifier, e.g. `/` or `/post/`.
39
+
40
+
If you set `DirectoryClassifier.path` to `/`, it means that you want to access the matched pages list at `/`. set
41
+
to `/post/` is the same.
42
+
43
+
### layout
44
+
45
+
- Type: `string`
46
+
- Default: `'IndexPost' || 'Layout'`
47
+
- Required: `false`
48
+
49
+
Layout component name for entry page.
50
+
51
+
### frontmatter
52
+
53
+
- Type: `Record<string, any>`
54
+
- Default: `{}`
55
+
- Required: `false`
56
+
57
+
[Frontmatter](https://v1.vuepress.vuejs.org/guide/frontmatter.html) for entry page.
58
+
59
+
### itemLayout
60
+
61
+
- Type: `string`
62
+
- Default: `'Post'`
63
+
- Required: `false`
64
+
65
+
Layout for matched pages.
66
+
67
+
### itemPermalink
68
+
69
+
- Type: `string`
70
+
- Default: `'/:year/:month/:day/:slug'`
71
+
- Required: `false`
72
+
73
+
Permalink for matched pages.
74
+
75
+
For example, if you set up a directory classifier with dirname equals to `_post`, and have following pages:
76
+
77
+
```
78
+
.
79
+
└── _posts
80
+
├── 2018-4-4-intro-to-vuepress.md
81
+
└── 2019-6-8-intro-to-vuepress-next.md
82
+
```
83
+
84
+
With the default `itemPermalink`, you'll get following output paths:
85
+
86
+
```
87
+
/2018/04/04/intro-to-vuepress/
88
+
/2019/06/08/intro-to-vuepress-next/
89
+
```
90
+
91
+
For more details about permalinks, please head to [Permalinks](https://v1.vuepress.vuejs.org/guide/permalinks.html) section at VuePress's documentation.
92
+
93
+
### pagination
94
+
95
+
- Type: `Pagination`
96
+
- Default: `{ perPagePosts: 10 }`
97
+
- Required: `false`
98
+
99
+
All available options of pagination are as follows:
100
+
101
+
- pagination.perPagePosts: Maximum number of posts per page.
102
+
- pagination.pagesSorter: Maximum number of posts per page.
0 commit comments