File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff 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' ,
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments