Skip to content

Commit 1453efd

Browse files
authored
website: Add redirect settings (#500)
Redirect pages that are no longer in 2.0 to 1.0. Plugins to use: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-client-redirects
1 parent 2843025 commit 1453efd

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

website/docusaurus.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,29 @@ const config: Config = {
100100

101101
plugins: [
102102
'./src/plugins/csv-loader/index.ts',
103+
[
104+
'@docusaurus/plugin-client-redirects',
105+
{
106+
redirects: [
107+
{ from: '/getting-started/contribute', to: '/overview/contribute' },
108+
{ from: '/getting-started/project-overview', to: '/' },
109+
{ from: '/getting-started/safety-guide', to: '/overview/safety-guide' },
110+
],
111+
createRedirects(existingPath: string) {
112+
const removedInV2 = [
113+
'/1.0/hardware/assembly-guide',
114+
'/1.0/hardware/bill-of-materials',
115+
'/1.0/hardware/specifications',
116+
'/1.0/hardware/wiring-and-casing-guide',
117+
'/1.0/software',
118+
];
119+
if (!removedInV2.some((path) => existingPath.startsWith(path))) {
120+
return;
121+
}
122+
return [existingPath.replace(/^\/1\.0/, '')];
123+
},
124+
},
125+
],
103126
],
104127

105128
themeConfig: {

website/package-lock.json

Lines changed: 25 additions & 0 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
@@ -20,6 +20,7 @@
2020
"dependencies": {
2121
"@docusaurus/core": "3.10.1",
2222
"@docusaurus/faster": "3.10.1",
23+
"@docusaurus/plugin-client-redirects": "3.10.1",
2324
"@docusaurus/preset-classic": "3.10.1",
2425
"@mdx-js/react": "^3.1.1",
2526
"clsx": "^2.0.0",

0 commit comments

Comments
 (0)