Skip to content

Instantly share code, notes, and snippets.

@rogeruiz
Created October 21, 2021 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogeruiz/875fa7fcb21ce53f521a79ea9a59ba56 to your computer and use it in GitHub Desktop.
Save rogeruiz/875fa7fcb21ce53f521a79ea9a59ba56 to your computer and use it in GitHub Desktop.
Helpful for doing redirects on pages that we drastically changed for MilMove Docusaurus
M docs/backend/guides/_category_.json
@@ -1,5 +1,5 @@
{
"label": "Guides",
"position": 3,
- "collapsed": true
+ "collapsed": false
}
M docusaurus.config.js
@@ -167,5 +167,20 @@ module.exports = {
],
plugins: [
require.resolve('@cmfcmf/docusaurus-search-local'),
+ [
+ '@docusaurus/plugin-client-redirects',
+ {
+ createRedirects: (existingPath) => {
+ if (existingPath === '/docs/backend/guides/how-to-handle-errors') {
+ return [
+ '/docs/backend/guides/handle-backend-errors',
+ '/docs/backend/guides/handle-backend-errors/',
+ '/docs/dev/contributing/backend/handle-backend-errors',
+ '/docs/dev/contributing/backend/handle-backend-errors/',
+ ];
+ }
+ },
+ }
+ ],
],
};
M package.json
@@ -16,6 +16,7 @@
"dependencies": {
"@cmfcmf/docusaurus-search-local": "^0.6.6",
"@docusaurus/core": "2.0.0-beta.5",
+ "@docusaurus/plugin-client-redirects": "2.0.0-beta.5",
"@docusaurus/preset-classic": "2.0.0-beta.5",
"@mdx-js/react": "^1.6.21",
"@svgr/webpack": "^5.5.0",
M yarn.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment