From 433fd8b7c9898b9ac447376e817a4716eceedf37 Mon Sep 17 00:00:00 2001 From: slorber Date: Tue, 23 Jun 2020 14:34:34 +0200 Subject: [PATCH 1/2] add plugin redirects production build note --- website/docs/using-plugins.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/website/docs/using-plugins.md b/website/docs/using-plugins.md index 775bc0912a17..15307e4d8f3a 100644 --- a/website/docs/using-plugins.md +++ b/website/docs/using-plugins.md @@ -84,8 +84,7 @@ A plugin is a module which exports a function that takes two parameters and retu The exported modules for plugins are called with two parameters: `context` and `options` and returns a JavaScript object with defining the [lifecycle APIs](./lifecycle-apis.md). -For example if you have a reference to a local folder such as this in your -docusaurus.config.js: +For example if you have a reference to a local folder such as this in your docusaurus.config.js: plugins: [path.resolve(__dirname, 'my-plugin')], @@ -103,8 +102,7 @@ module.exports = function(context, options) { }; ``` -The `my-plugin` folder could also be a fully fledged package with it's own -package.json and a `src/index.js` file for example +The `my-plugin` folder could also be a fully fledged package with it's own package.json and a `src/index.js` file for example #### `context` @@ -475,6 +473,12 @@ Docusaurus Plugin to generate **client-side redirects**. This plugin will write additional HTML pages to your static site, that redirects the user to your existing Docusaurus pages with JavaScript. +:::note + +This plugin only create redirects for the production build. + +::: + :::caution It is better to use server-side redirects whenever possible. From 6d6cc2a754eee9af079bb2e74a4b3d5ca82647b3 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 23 Jun 2020 20:41:51 +0800 Subject: [PATCH 2/2] Update using-plugins.md --- website/docs/using-plugins.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/website/docs/using-plugins.md b/website/docs/using-plugins.md index 15307e4d8f3a..1ebb8d0f194a 100644 --- a/website/docs/using-plugins.md +++ b/website/docs/using-plugins.md @@ -84,9 +84,14 @@ A plugin is a module which exports a function that takes two parameters and retu The exported modules for plugins are called with two parameters: `context` and `options` and returns a JavaScript object with defining the [lifecycle APIs](./lifecycle-apis.md). -For example if you have a reference to a local folder such as this in your docusaurus.config.js: +For example if you have a reference to a local folder such as this in your `docusaurus.config.js`: - plugins: [path.resolve(__dirname, 'my-plugin')], +```js title="docusaurus.config.js" +module.exports = { + // ... + plugins: [path.resolve(__dirname, 'my-plugin')], +}; +``` Then in the folder `my-plugin` you can create an index.js such as this