mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-30 17:37:09 +02:00
docs(v2): add documentation for multiple blogs (#2933)
* docs(v2): add documentation for multiple blogs * docs(v2): fix typos of docusaurus * docs(v2): make the same changes in the latest version of documentation * docs(v2): remove an empty blockquote * docs(v2): improve documentation for multiple blogs
This commit is contained in:
parent
22178ebded
commit
8eed245000
9 changed files with 70 additions and 15 deletions
|
@ -163,6 +163,34 @@ Make sure there's no `index.js` page in `src/pages` or else there will be two fi
|
|||
|
||||
:::
|
||||
|
||||
### Multiple blogs
|
||||
|
||||
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 second blog's entries.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
// ...
|
||||
plugins: [
|
||||
[
|
||||
'@docusaurus/plugin-content-blog',
|
||||
{
|
||||
/**
|
||||
* 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',
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Adding a blog using the blog plugin.
|
||||
|
|
|
@ -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
|
||||
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -159,6 +159,34 @@ Make sure there's no `index.js` page in `src/pages` or else there will be two fi
|
|||
|
||||
:::
|
||||
|
||||
### Multiple blogs
|
||||
|
||||
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 second blog's entries.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
// ...
|
||||
plugins: [
|
||||
[
|
||||
'@docusaurus/plugin-content-blog',
|
||||
{
|
||||
/**
|
||||
* 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',
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Adding a blog using the blog plugin.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue