blog theme

This commit is contained in:
Shigma
2019-03-07 15:31:13 +08:00
parent 90cf995d26
commit 30a59c8109
+39 -15
View File
@@ -4,7 +4,7 @@
# Summary
- `@vuepress/plugin-blog`, featured with tags, categories, drafting, timeline, pagination
- `@vuepress/plugin-blog`, featured with tags, categories, drafting, timeline, pagination and multi-authors
- `@vuepress/theme-blog`, featured with
# Basic example
@@ -17,7 +17,7 @@ With popular demand, VuePress will provide some official blog supports, includin
See: [#36](https://github.com/vuejs/vuepress/issues/36)
# Detailed design
# Blog Plugin
## Pagination
@@ -33,9 +33,7 @@ module.exports = {
postsSorter (postA, postB) {
// default: Array.prototype.sort
},
formatUrl (index) {
// default: index => `page/${index}/`
},
pageUrl: 'page/:index/',
postsPerPage: 10,
layout: 'Pagination',
},
@@ -60,7 +58,7 @@ tags:
```js
module.exports = {
themeConfig: {
tagUrl: 'tags' // default
tagUrl: 'tags',
}
}
```
@@ -82,7 +80,7 @@ category: cat
```js
module.exports = {
themeConfig: {
categoryUrl: 'categories' // default
categoryUrl: 'categories',
}
}
```
@@ -93,8 +91,6 @@ module.exports = {
- `/categories/dog/page/2/`
- ......
If a post has its category, its previous/next page will be posts next to it under the same category.
## Authoring
### With Only One Author
@@ -203,7 +199,7 @@ With the aid of `@vuepress/plugin-git-log` (in another RFC), these meta informat
## Directory-level Configuration
Drafting can also be specified via config:
Tags, categories, drafting and authors can also be specified via `config.js`:
```js
module.exports = {
@@ -215,18 +211,50 @@ module.exports = {
},
{
path: 'frontend',
tags: ['CS'],
category: 'frontend',
},
{
path: 'authors',
layout: 'About',
permalink: '/authors/:slug/about.html',
permalink: '/authors/:slug/',
},
]
}
}
```
And the configuration above follows several rules:
- Tags will be automatically merged into an array, while other properties will override each other.
- Configurations below override configurations above.
# Blog Theme
## Thumbnails
```md
---
thumbnail: /image.png
---
```
This will show as background image of title, and will be displayed together with excerpt in the pagination view.
## Markdown Syntax
- custom containers designed for blog
## Sidebar on the Right
There will be a sidebar on the right, which contains:
- table of contents
- author information
- back-to-top button
All of them are optional, but provided by default.
# Drawbacks
N/A
@@ -245,10 +273,6 @@ N/A
# Unresolved questions
## How should we handle the generation of links?
We have permalink patterns for now. But for future, we may need a more comprehensive plan. For example, `page/:index.html` for pagination.
## Page redirection fails due to SSR mismatch
When using pagination, VuePress will automatically generate pages with urls like this: