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.
30
-
}
31
-
```
32
-
33
-
## Tutorials
34
-
35
-
### Document Classifier
36
-
37
-
`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:
38
-
39
-
- Pages put in a directory (e.g. `_post`)
40
-
- Pages containing the same specific frontmatter key value (e.g. `tag: js`).
41
-
42
-
Of course, both of them may be related to another common
43
-
requirement, `pagination`.
44
-
45
-
So, how to combine them skillfully? Next, let's take a look at how this plugin solve these problems.
46
-
47
-
### Directory Classifier
48
-
49
-
Directory Classifier, that classifies the source pages placed in a same directory.
50
-
51
-
Suppose you have the following files structure:
52
-
53
-
```vue
54
-
.
55
-
└── _posts
56
-
├── 2018-4-4-intro-to-vuepress.md
57
-
└── 2019-6-8-intro-to-vuepress-next.md
58
-
```
59
-
60
-
In the traditional VuePress site, the converted page URLs will be:
61
-
62
-
-`_posts/2018-4-4-intro-to-vuepress.html`
63
-
-`_posts/2019-6-8-intro-to-vuepress-next.html`
64
-
65
-
It doesn't seem blogging, so it's time to use this plugin:
66
-
67
-
```js
68
-
// .vuepress/config.js
69
-
module.exports= {
70
-
plugins: [
71
-
[
72
-
'@vuepress/blog',
73
-
{
74
-
directories: [
75
-
{
76
-
// Unique ID of current classification
77
-
id:'post',
78
-
// Target directory
79
-
dirname:'_posts',
80
-
// Path of the `entry page` (or `list page`)
81
-
path:'/',
82
-
},
83
-
],
84
-
},
85
-
],
86
-
],
87
-
}
88
-
```
89
-
90
-
Then the plugin will help you to generate following pages, and automatically leverage corresponding
In the `Tags` component, you can use `this.$tag.list` to get the tag list. The value would be like:
293
-
294
-
```json
295
-
[
296
-
{
297
-
"name": "vue",
298
-
"path": "/tag/vue/",
299
-
"pages": [
300
-
{ "relativePath": "b.md", "path": "/b.html"... },
301
-
{ "relativePath": "a.md", "path": "/a.html"... },
302
-
]
303
-
},
304
-
{
305
-
"name": "js",
306
-
"path": "/tag/js/",
307
-
"pages": [
308
-
{ "relativePath": "c.md", "path": "/c.html"... },
309
-
]
310
-
}
311
-
]
312
-
```
313
-
314
-
In the `FrontmatterPagination` component, you can use `this.$pagination.pages` to get the matched pages in current tag
315
-
classification:
316
-
317
-
- If you visit `/tag/vue/`, the `this.$pagination.pages` will be:
318
-
319
-
```json
320
-
[
321
-
{ "relativePath": "b.md", "path": "/b.html"... },
322
-
{ "relativePath": "a.md", "path": "/a.html"... },
323
-
]
324
-
```
325
-
326
-
- If you visit `/tag/js/`, the `this.$pagination.pages` will be:
327
-
328
-
```json
329
-
[
330
-
{ "relativePath": "c.md", "path": "/c.html"... },
331
-
]
332
-
```
333
-
334
-
## Examples
335
-
336
-
Actually, there are only 2 necessary layout components to create a blog theme:
337
-
338
-
- Layout
339
-
- Post
340
-
- Tag (Only required when you set up a `tag` frontmatter classification.)
341
-
342
-
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.
38
+
All available options are [here](./config/README.md).
0 commit comments