From eef62830da66f2ea543f13f1ee2491e979a4a1bf Mon Sep 17 00:00:00 2001 From: teikjun Date: Sun, 14 Jun 2020 23:57:02 +0800 Subject: [PATCH 1/5] docs(v2): add documentation for multiple blogs --- website/docs/blog.md | 15 +++++++++++++++ .../version-2.0.0-alpha.56/blog.md | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/website/docs/blog.md b/website/docs/blog.md index 44bf75c45459..08469ee838cf 100644 --- a/website/docs/blog.md +++ b/website/docs/blog.md @@ -163,6 +163,20 @@ Make sure there's no `index.js` page in `src/pages` or else there will be two fi ::: +```js {4-10} title="docusaurus.config.js" +module.exports = { + // ... + plugins: [ + [ + '@docusaurus/plugin-content-blog', + { + routeBasePath: 'my-blog', // URL route for your blog + path: './my-blog', // path to your blog folder + }, + ], + ], +} + +``` diff --git a/website/versioned_docs/version-2.0.0-alpha.56/blog.md b/website/versioned_docs/version-2.0.0-alpha.56/blog.md index a0a4bc41ab36..1394a0d61a1b 100644 --- a/website/versioned_docs/version-2.0.0-alpha.56/blog.md +++ b/website/versioned_docs/version-2.0.0-alpha.56/blog.md @@ -159,6 +159,25 @@ Make sure there's no `index.js` page in `src/pages` or else there will be two fi ::: +### Multiple blogs + +You can add another blog by specifying your own blog plugin in the `plugins` option. Set the `routeBasePath` to the URL route that you want your blog to be accessed on. Also, set `path` to the path to your blog folder. + +```js {4-10} title="docusaurus.config.js" +module.exports = { + // ... + plugins: [ + [ + '@docusaurus/plugin-content-blog', + { + routeBasePath: 'my-blog', // URL route for your blog + path: './my-blog', // path to your blog folder + }, + ], + ], +}; +``` + + +``` + ``` From 2c4945fcacd70aed1a798d71da250ad88f3f2ad1 Mon Sep 17 00:00:00 2001 From: teikjun Date: Mon, 15 Jun 2020 00:12:20 +0800 Subject: [PATCH 4/5] docs(v2): remove an empty blockquote --- website/docs/blog.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/website/docs/blog.md b/website/docs/blog.md index a90c7676ff5c..dc5ce9fa7cb8 100644 --- a/website/docs/blog.md +++ b/website/docs/blog.md @@ -192,7 +192,3 @@ References - [v1 doc](https://docusaurus.io/docs/en/next/adding-blog) --> - -``` - -``` From dc176b25ef51748cd962625c37ed70159fe9f6bb Mon Sep 17 00:00:00 2001 From: teikjun Date: Mon, 15 Jun 2020 01:34:54 +0800 Subject: [PATCH 5/5] docs(v2): improve documentation for multiple blogs --- website/docs/blog.md | 17 +++++++++++++---- .../version-2.0.0-alpha.56/blog.md | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/website/docs/blog.md b/website/docs/blog.md index dc5ce9fa7cb8..b792b2e32dca 100644 --- a/website/docs/blog.md +++ b/website/docs/blog.md @@ -165,17 +165,26 @@ Make sure there's no `index.js` page in `src/pages` or else there will be two fi ### Multiple blogs -You can add another blog by specifying your own blog plugin in the `plugins` option. Set the `routeBasePath` to the URL route that you want your blog to be accessed on. Also, set `path` to the path to your blog folder. +By default, the classic theme assumes only one blog per website and hence includes only one instance of the blog plugin. If you would like to have multiple blogs on a single website, it's possible too! You can add another blog by specifying another blog plugin in the `plugins` option for `docusaurus.config.js`. -```js {4-10} title="docusaurus.config.js" +Set the `routeBasePath` to the URL route that you want your second blog to be accessed on. Note that the `routeBasePath` here has to be different from the first blog or else there could be a collision of paths! Also, set `path` to the path to the directory containing your second blog's entries. + +```js title="docusaurus.config.js" module.exports = { // ... plugins: [ [ '@docusaurus/plugin-content-blog', { - routeBasePath: 'my-blog', // URL route for your blog - path: './my-blog', // path to your blog folder + /** + * URL route for the blog section of your site. + * *DO NOT* include a trailing slash. + */ + routeBasePath: 'my-second-blog', + /** + * Path to data on filesystem relative to site dir. + */ + path: './my-second-blog', }, ], ], diff --git a/website/versioned_docs/version-2.0.0-alpha.56/blog.md b/website/versioned_docs/version-2.0.0-alpha.56/blog.md index 1394a0d61a1b..0872073a34e3 100644 --- a/website/versioned_docs/version-2.0.0-alpha.56/blog.md +++ b/website/versioned_docs/version-2.0.0-alpha.56/blog.md @@ -161,17 +161,26 @@ Make sure there's no `index.js` page in `src/pages` or else there will be two fi ### Multiple blogs -You can add another blog by specifying your own blog plugin in the `plugins` option. Set the `routeBasePath` to the URL route that you want your blog to be accessed on. Also, set `path` to the path to your blog folder. +By default, the classic theme assumes only one blog per website and hence includes only one instance of the blog plugin. If you would like to have multiple blogs on a single website, it's possible too! You can add another blog by specifying another blog plugin in the `plugins` option for `docusaurus.config.js`. -```js {4-10} title="docusaurus.config.js" +Set the `routeBasePath` to the URL route that you want your second blog to be accessed on. Note that the `routeBasePath` here has to be different from the first blog or else there could be a collision of paths! Also, set `path` to the path to the directory containing your second blog's entries. + +```js title="docusaurus.config.js" module.exports = { // ... plugins: [ [ '@docusaurus/plugin-content-blog', { - routeBasePath: 'my-blog', // URL route for your blog - path: './my-blog', // path to your blog folder + /** + * URL route for the blog section of your site. + * *DO NOT* include a trailing slash. + */ + routeBasePath: 'my-second-blog', + /** + * Path to data on filesystem relative to site dir. + */ + path: './my-second-blog', }, ], ],