Skip to content

Commit a5d7ad3

Browse files
committed
Fixed redirect
1 parent bd513ad commit a5d7ad3

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

website/docusaurus.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,46 @@ const config = {
5050
customCss: require.resolve('./src/css/custom.css'),
5151
},
5252
}),
53+
]
54+
],
55+
56+
plugins: [
57+
[
58+
'@docusaurus/plugin-client-redirects',
59+
{
60+
redirects: [
61+
{
62+
to: '/docs/start-server',
63+
from: '/guide/http_server'
64+
},
65+
{
66+
to: '/docs/cookbook/subdomain',
67+
from: '/cookbook/subdomains'
68+
},
69+
{
70+
to: '/docs/cookbook/timeout',
71+
from: '/cookbook/timeouts'
72+
}
73+
],
74+
createRedirects(existingPath) {
75+
if (existingPath.includes('/docs/middleware')) {
76+
return [
77+
existingPath.replace('/docs/middleware', '/middleware'),
78+
];
79+
}
80+
if (existingPath.includes('/docs/cookbook')) {
81+
return [
82+
existingPath.replace('/docs/cookbook', '/cookbook'),
83+
];
84+
}
85+
if (existingPath.includes('/docs')) {
86+
return [
87+
existingPath.replace('/docs', '/guide'),
88+
];
89+
}
90+
return undefined; // Return a falsy value: no redirect created
91+
},
92+
},
5393
],
5494
],
5595

website/package-lock.json

Lines changed: 27 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@docusaurus/core": "2.4.1",
18+
"@docusaurus/plugin-client-redirects": "^2.4.1",
1819
"@docusaurus/preset-classic": "2.4.1",
1920
"@mdx-js/react": "^1.6.22",
2021
"clsx": "^1.2.1",

0 commit comments

Comments
 (0)