@@ -460,6 +460,7 @@ async function createComponentPages({actions, graphql}) {
460
460
const railsComponentLayout = path . resolve ( __dirname , 'src/layouts/rails-component-layout.tsx' )
461
461
const figmaComponentLayout = path . resolve ( __dirname , 'src/layouts/figma-component-layout.tsx' )
462
462
const cssComponentLayout = path . resolve ( __dirname , 'src/layouts/css-component-layout.tsx' )
463
+ const redirectLayout = path . resolve ( __dirname , 'src/layouts/redirect-layout.tsx' )
463
464
464
465
for ( const { slug, frontmatter} of data . allMdx . nodes ) {
465
466
if ( frontmatter . reactId ) {
@@ -481,11 +482,20 @@ async function createComponentPages({actions, graphql}) {
481
482
}
482
483
}
483
484
484
- actions . createRedirect ( {
485
- fromPath : `/${ slug } /react/latest` ,
486
- toPath : `/${ slug } /react/${ latestStatusFrom ( statuses ) } ` ,
487
- redirectInBrowser : true ,
488
- force : true ,
485
+ actions . createPage ( {
486
+ path : `/${ slug } /react/latest` ,
487
+ component : redirectLayout ,
488
+ context : {
489
+ location : `/${ slug } /react/${ latestStatusFrom ( statuses ) } `
490
+ }
491
+ } )
492
+
493
+ actions . createPage ( {
494
+ path : `/${ slug } /react` ,
495
+ component : redirectLayout ,
496
+ context : {
497
+ location : `/${ slug } /react/${ latestStatusFrom ( statuses ) } `
498
+ }
489
499
} )
490
500
}
491
501
@@ -514,11 +524,20 @@ async function createComponentPages({actions, graphql}) {
514
524
} )
515
525
} )
516
526
517
- actions . createRedirect ( {
518
- fromPath : `/${ slug } /rails/latest` ,
519
- toPath : `/${ slug } /rails/${ latestStatusFrom ( statuses ) } ` ,
520
- redirectInBrowser : true ,
521
- force : true ,
527
+ actions . createPage ( {
528
+ path : `/${ slug } /rails/latest` ,
529
+ component : redirectLayout ,
530
+ context : {
531
+ location : `/${ slug } /rails/${ latestStatusFrom ( statuses ) } `
532
+ }
533
+ } )
534
+
535
+ actions . createPage ( {
536
+ path : `/${ slug } /rails` ,
537
+ component : redirectLayout ,
538
+ context : {
539
+ location : `/${ slug } /rails/${ latestStatusFrom ( statuses ) } `
540
+ }
522
541
} )
523
542
}
524
543
0 commit comments