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.
Copy file name to clipboardExpand all lines: docs/README.md
+54-30Lines changed: 54 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ sidebar: auto
4
4
5
5
# @vuepress/plugin-blog
6
6
7
-
> Official blog theme for VuePress.
7
+
> Official blog plugin for VuePress.
8
8
9
-
Note that this plug-in has been deeply integrated into [@vuepress/theme-blog](https://github.com/ulivz/vuepress-theme-blog).
9
+
Note that this plugin has been deeply integrated into [@vuepress/theme-blog](https://github.com/ulivz/vuepress-theme-blog).
10
10
11
11
## Install
12
12
@@ -26,19 +26,22 @@ module.exports = {
26
26
27
27
## Tutorials
28
28
29
-
### Classifier
29
+
### Document Classifier
30
30
31
-
This plugin creates a concept named `classifier`. All files in a directory (e.g. `_post`) should be the
32
-
same classification, all pages containing the same specific frontmatter key value (e.g. `tag: js`) can also be a
33
-
classification.
31
+
`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:
34
32
35
-
So there are two different types of classification. Of course, both of them may be related to another common
36
-
requirement, `pagination`. Next, let's take a look at the benefits of this plugin from the shallow to the deep.
33
+
- Pages put in a directory (e.g. `_post`)
34
+
- Pages containing the same specific frontmatter key value (e.g. `tag: js`).
35
+
36
+
Of course, both of them may be related to another common
37
+
requirement, `pagination`.
38
+
39
+
So, how to combine them skillfully? Next, let's take a look at how this plugin solve these problems.
37
40
38
41
39
42
### Directory Classifier
40
43
41
-
Directory Classifier, that means the classification of source files in a same directory.
44
+
Directory Classifier, that classifies the source pages placed in a same directory.
42
45
43
46
Suppose you have the following files structure:
44
47
@@ -81,7 +84,7 @@ layout:
81
84
82
85
| url | layout |
83
86
|---|---|
84
-
|`/`|`IndexPost`|
87
+
|`/`|`IndexPost`/ `Layout`|
85
88
|`/2018/04/04/intro-to-vuepress/`|`Post`|
86
89
|`/2019/06/08/intro-to-vuepress-next/`|`Post`|
87
90
@@ -142,7 +145,7 @@ The default value of `itemPermalink` is `'/:year/:month/:day/:slug'`.
142
145
As your blog articles grew more and more, you began to have the need for paging. By default, this plugin integrates a
143
146
very powerful pagination system that allows you to access paging functions with simple configuration.
144
147
145
-
By default, the plugin assumes that the number of pages per page is `10`. you can also modify it like this:
148
+
By default, the plugin assumes that the max number of pages per page is `10`. you can also modify it like this:
146
149
147
150
```diff
148
151
// .vuepress/config.js
@@ -174,16 +177,20 @@ When the `perPagePosts` is set to `2`, this plugin will help you generate the fo
Isn't a very natural experiences? You just need to care about the style of your layout component, not the complicated and boring logic behind it.
212
+
Isn't this very natural experience? You just need to care about the style of your layout component, not the complicated and boring logic behind it.
206
213
207
214
208
215
::: tip
209
-
To save the length of docs, we omitted the data structure of `$page` object. you can get more information about
216
+
To save the length of docs, we omitted the data structure of the `$page` object. You can get more information about
210
217
the data structure of `$page` at the [official documentation](https://v1.vuepress.vuejs.org/guide/global-computed.html#page).
211
218
:::
212
219
213
220
214
221
### Frontmatter Classifier
215
222
216
-
Frontmatter Classifier, that is the classification of pages that have the same frontmatter key values.
223
+
Frontmatter Classifier, which classifies pages that have the same frontmatter key values.
217
224
218
225
Suppose you have three pages:
219
226
@@ -258,22 +265,22 @@ module.exports = {
258
265
// Layout of the `entry page`
259
266
layout:'Tag',
260
267
},
261
-
]
268
+
]
262
269
}]
263
270
]
264
271
}
265
272
```
266
273
267
-
Then the plugin will help you to generate following extra pages, and automatically leverage corresponding
268
-
layout:
274
+
Then the plugin will help you to generate the following extra pages, and automatically leverage
275
+
the corresponding layout:
269
276
270
277
| url | layout |
271
278
|---|---|
272
279
|`/tag/`|`Tag`|
273
-
|`/tag/vue/`|`FrontmatterClassifier`|
274
-
|`/tag/js/`|`FrontmatterClassifier`|
280
+
|`/tag/vue/`|`FrontmatterPagination` / `Layout`|
281
+
|`/tag/js/`|`FrontmatterPagination` / `Layout`|
275
282
276
-
In `Tags` component, you can use `this.$tag.list` to get the tag list. the value would be like:
283
+
In the `Tags` component, you can use `this.$tag.list` to get the tag list. The value would be like:
277
284
278
285
```json
279
286
[
@@ -295,9 +302,8 @@ In `Tags` component, you can use `this.$tag.list` to get the tag list. the value
295
302
]
296
303
```
297
304
298
-
In `FrontmatterClassifier` component, you can use `this.$pagination.pages` to get the matched pages in current tag
299
-
classification. And what is wonderful is that a you don't nned to card about where you are, and you'll get a very
300
-
natural experiences:
305
+
In the `FrontmatterPagination` component, you can use `this.$pagination.pages` to get the matched pages in current tag
306
+
classification:
301
307
302
308
- If you visit `/tag/vue/`, the `this.$pagination.pages` will be:
303
309
@@ -317,8 +323,26 @@ natural experiences:
317
323
```
318
324
319
325
326
+
## Examples
320
327
328
+
Actually, there are only 2 necessary layout components to create a blog theme:
329
+
330
+
- Layout
331
+
- Post
332
+
- Tag (Only required when you set up a `tag` frontmatter classification.)
333
+
334
+
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.
0 commit comments