@@ -8,8 +8,7 @@ type RedirectRule = {
88
99// Release notes redirects (not affected by base path)
1010function generateReleaseNotesRedirects ( ) : RedirectRule [ ] {
11- return [
12- ] ;
11+ return [ ] ;
1312}
1413
1514// Documentation redirects
@@ -20,7 +19,17 @@ function generateDocsRedirects(basePath: string): RedirectRule[] {
2019 return basePath === '/' ? path : `${ basePath } ${ path } ` ;
2120 } ;
2221
23- return [
22+ const redirects : RedirectRule [ ] = [ ] ;
23+
24+ // Only add root redirect if docs are not at root
25+ if ( basePath !== '/' ) {
26+ redirects . push ( {
27+ from : '/' ,
28+ to : basePath ,
29+ } ) ;
30+ }
31+
32+ redirects . push (
2433 // Operations API
2534 {
2635 from : withBase ( '/developers/operations-api/utilities' ) ,
@@ -145,16 +154,15 @@ function generateDocsRedirects(basePath: string): RedirectRule[] {
145154 { from : withBase ( '/api' ) , to : withBase ( '/developers/operations-api/' ) } ,
146155
147156 // File rename redirect
148- { from : withBase ( '/administration/logging/logging' ) , to : withBase ( '/administration/logging/standard-logging' ) } ,
149- ] ;
157+ { from : withBase ( '/administration/logging/logging' ) , to : withBase ( '/administration/logging/standard-logging' ) }
158+ ) ;
159+
160+ return redirects ;
150161}
151162
152163// Combine all redirects
153164export function generateRedirects ( basePath : string ) : RedirectRule [ ] {
154- return [
155- ...generateReleaseNotesRedirects ( ) ,
156- ...generateDocsRedirects ( basePath ) ,
157- ] ;
165+ return [ ...generateReleaseNotesRedirects ( ) , ...generateDocsRedirects ( basePath ) ] ;
158166}
159167
160168// For backward compatibility, export a default set with empty base path
0 commit comments