Fix deleted page redirects

Summary:
The redirects we added inline in the deleted pages don't work when there's a baseUrl.

This is because it's the standard react-router Redirect component, which knows nothing about docusaurus sites.

We could get around that by adding `useBaseUrl()` calls around all of them, but that's not great.
So changing to using declarative redirects instead, where they are all put in config. This automatically takes care of base urls, and reduces copy-pasted code.

Reviewed By: passy

Differential Revision: D25780599

fbshipit-source-id: c67d3643ab28f0fcd440904baf54c67687781686
This commit is contained in:
John Knox
2021-01-05 09:22:28 -08:00
committed by Facebook GitHub Bot
parent 8a8b979f66
commit c460cb767f
9 changed files with 78 additions and 27 deletions

View File

@@ -171,6 +171,64 @@ const siteConfig = {
],
],
// end_config_example
plugins: [
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
to: '/docs/troubleshooting',
from: ['/docs/fb/troubleshooting'],
},
{
to: '/docs/tutorial/intro',
from: ['/docs/extending'],
},
{
to: '/docs/extending/desktop-plugin-structure',
from: ['/docs/extending/js-setup'],
},
{
to: '/docs/extending/create-plugin',
from: [
'/docs/extending/send-data',
'/docs/fb/android-plugin-development-Android-interacting-0',
],
},
{
to: '/docs/tutorial/intro',
from: ['/docs/fb/create-new-plugin'],
},
{
to: '/docs/extending/dev-setup',
from: ['/docs/fb/developmentworkflow'],
},
{
to: '/docs/getting-started/index',
from: ['/docs/fb/Help-Updating-Flipper'],
},
{
to: '/docs/extending/create-plugin',
from: [
'/docs/fb/ios-plugin-development-sending-data-to-an-ios-plugin-0',
],
},
{
to: '/docs/extending/dev-setup',
from: ['/docs/fb/TypeScript'],
},
{
to: '/docs/extending/flipper-plugin',
from: ['/docs/fb/using-gatekeepers'],
},
{
to: '/docs/getting-started/index',
from: ['/docs/fb/using-flipper-at-facebook'],
},
],
},
],
],
};
module.exports = siteConfig;