Skip to content

Commit 09c48c7

Browse files
committed
[FLUSS-2062][docs] Added Redirect for Latest Stable Version Docs
1 parent 4ce849f commit 09c48c7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

website/docusaurus.config.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,32 @@ const config: Config = {
124124
],
125125
},
126126
],
127+
[
128+
'@docusaurus/plugin-client-redirects',
129+
{
130+
// Create redirects from the available routes that have already been created
131+
createRedirects(existingPath) {
132+
// Only evaluate paths related to documentation
133+
if (!existingPath.startsWith('/docs/')) {
134+
return undefined;
135+
}
136+
137+
// Extract the relative path after /docs/
138+
const relativeDocsPath = existingPath.substring(6);
139+
const firstSegment = relativeDocsPath.split('/')[0];
140+
141+
// Exclude any known version identifiers aligned with existing routes
142+
const existingVersionedRoutes = ['next', ...Object.keys(versionsMap)];
143+
if (existingVersionedRoutes.includes(firstSegment)) {
144+
return undefined;
145+
}
146+
147+
// Redirect the explicit versioned path to the implicit unversioned path
148+
return [`/docs/${latestVersion}${existingPath.replace('/docs', '')}`];
149+
},
150+
},
151+
],
152+
127153
],
128154
themeConfig: {
129155
image: 'img/logo/png/colored_logo.png',

website/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@docusaurus/core": "^3.9.2",
1919
"@docusaurus/plugin-pwa": "^3.9.2",
20+
"@docusaurus/plugin-client-redirects": "^3.9.2",
2021
"@docusaurus/preset-classic": "^3.9.2",
2122
"@mdx-js/react": "^3.0.0",
2223
"algoliasearch": "^5.10.2",

0 commit comments

Comments
 (0)