feat(plugin-blog): allow 'ALL' as postsPerPage option value (#5354)

* 'ALL' option

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Guard against zero posts

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Remove redundant code

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
Joshua Chen 2021-08-17 19:07:18 +08:00 committed by GitHub
parent ee6882650e
commit 7d0272fe4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 11 deletions

View file

@ -112,7 +112,7 @@ Not this.
Or this.
```
By default, 10 posts are shown on each blog list page, but you can control pagination with the `postsPerPage` option in the plugin configuration. You can also add meta description to the blog list page for better SEO:
By default, 10 posts are shown on each blog list page, but you can control pagination with the `postsPerPage` option in the plugin configuration. If you set `postsPerPage: 'ALL'`, pagination will be disabled and all posts will be displayed on the first page. You can also add meta description to the blog list page for better SEO:
```js title="docusaurus.config.js"
module.exports = {
@ -125,7 +125,7 @@ module.exports = {
// highlight-start
blogTitle: 'Docusaurus blog!',
blogDescription: 'A Docusaurus powered blog!',
postsPerPage: 20,
postsPerPage: 'ALL',
// highlight-end
},
},