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
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions website/docs/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


```js {4-10} title="docusaurus.config.js"
module.exports = {
// ...
plugins: [
[
'@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'

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.

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'

},
],
],
};
```

<!--

Adding a blog using the blog plugin.
Expand Down
17 changes: 8 additions & 9 deletions website/docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ jobs:
node-version: '12.x'
- name: Test Build
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
gh-release:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -160,7 +160,6 @@ jobs:
npm i
fi
npx docusaurus deploy

```

1. Now when a new pull request arrives towards your repository in branch `documentation` it will automatically ensure that Docusaurus build is successful.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/using-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = {
plugins: [
[
'@docuaurus/plugin-content-pages',
'@docusaurus/plugin-content-pages',
{
/**
* Path to data on filesystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = {
plugins: [
[
'@docuaurus/plugin-content-pages',
'@docusaurus/plugin-content-pages',
{
/**
* Path to data on filesystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = {
plugins: [
[
'@docuaurus/plugin-content-pages',
'@docusaurus/plugin-content-pages',
{
/**
* Path to data on filesystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = {
plugins: [
[
'@docuaurus/plugin-content-pages',
'@docusaurus/plugin-content-pages',
{
/**
* Path to data on filesystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = {
plugins: [
[
'@docuaurus/plugin-content-pages',
'@docusaurus/plugin-content-pages',
{
/**
* Path to data on filesystem
Expand Down
19 changes: 19 additions & 0 deletions website/versioned_docs/version-2.0.0-alpha.56/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
],
],
};
```

<!--

Adding a blog using the blog plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ If you have installed `@docusaurus/preset-classic`, you don't need to install it
module.exports = {
plugins: [
[
'@docuaurus/plugin-content-pages',
'@docusaurus/plugin-content-pages',
{
/**
* Path to data on filesystem
Expand Down