Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(v2): add documentation for multiple blogs #2933

Merged
merged 5 commits into from
Jun 14, 2020

Conversation

teikjun
Copy link
Contributor

@teikjun teikjun commented Jun 14, 2020

Motivation

Add documentation about how to set up multiple blogs.

This PR closes #2481. It also fixes a minor typo.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

The changes can be viewed on Netlify here:
https://deploy-preview-2933--docusaurus-2.netlify.app/docs/blog/#multiple-blogs

Related Information

As noted in #2883, the user needs to add require.resolve(<plugin-name>) to the plugin name, in addition to the instructions stated in the documentation.
But I have excluded this to maintain consistency with the plugins documentation.

Should I make another PR to add in require.resolve for all plugin names?

@teikjun teikjun requested a review from yangshun as a code owner June 14, 2020 16:21
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jun 14, 2020
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Jun 14, 2020

Deploy preview for docusaurus-2 ready!

Built with commit dc176b2

https://deploy-preview-2933--docusaurus-2.netlify.app

@yangshun yangshun added the pr: documentation This PR works on the website or other text documents in the repo. label Jun 14, 2020
@yangshun yangshun changed the title docs(v2): docs(v2): add documentation for multiple blogs docs(v2): add documentation for multiple blogs Jun 14, 2020
Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing thids! This looks really good! I have some suggested changes before we can merge this.

@@ -163,6 +163,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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend using this:

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. 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 other second blog's entries.

[
'@docusaurus/plugin-content-blog',
{
routeBasePath: 'my-blog', // URL route for your blog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'my-second-blog'

'@docusaurus/plugin-content-blog',
{
routeBasePath: 'my-blog', // URL route for your blog
path: './my-blog', // path to your blog folder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'./my-second-blog'

[
'@docusaurus/plugin-content-blog',
{
routeBasePath: 'my-blog', // URL route for your blog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use comments similar to https://v2.docusaurus.io/docs/using-plugins#docusaurusplugin-content-blog to better elaborate on the options.

@teikjun
Copy link
Contributor Author

teikjun commented Jun 14, 2020

I have included your suggested changes, it looks much better now! :D

@teikjun teikjun requested a review from yangshun June 14, 2020 17:49
Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

@yangshun yangshun merged commit 8eed245 into facebook:master Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: documentation This PR works on the website or other text documents in the repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs(v2): document about allowing multiple blogs
4 participants