π¦ plugin-client-redirects
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.
Before using this plugin, you should look if your hosting provider doesn't offer this feature.
#
Installation- npm
- Yarn
#
ConfigurationMain usecase: you have /myDocusaurusPage
, and you want to redirect to this page from /myDocusaurusPage.html
:
Second usecase: you have /myDocusaurusPage.html
, and you want to redirect to this page from /myDocusaurusPage
.
For custom redirect logic, provide your own createRedirects
function.
Let's imagine you change the url of an existing page, you might want to make sure the old url still works:
It's possible to use a function to create the redirects for each existing path:
Finally, it's possible to use all options at the same time: