@@ -93,10 +93,10 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
9393 const envCreatePage = ( props ) => {
9494 const pageConfig = { ...props } ;
9595 pageConfig . slices = { ...DEFAULT_SLICES , ...( pageConfig . slices || { } ) } ;
96-
96+
9797 if ( process . env . CI === "true" ) {
9898 const { path, matchPath, ...rest } = pageConfig ;
99-
99+ const isHandbookPage = path . startsWith ( "/community/handbook/" ) ;
100100 createRedirect ( {
101101 fromPath : `/${ path } /` ,
102102 toPath : `/${ path } ` ,
@@ -105,7 +105,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
105105 } ) ;
106106
107107 return createPage ( {
108- path : `${ path } .html` ,
108+ path : isHandbookPage ? path : `${ path } .html` ,
109109 matchPath : matchPath || path ,
110110 ...rest ,
111111 } ) ;
@@ -469,30 +469,13 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
469469 }
470470
471471 handbook . forEach ( ( page ) => {
472- let finalSlug = page . fields . slug ;
473- // Strip `.html` for production builds so client-side router matches clean paths
474- if ( process . env . NODE_ENV === "production" ) {
475- finalSlug = finalSlug . replace ( / \. h t m l $ / , "" ) ;
476- }
477-
478472 envCreatePage ( {
479- path : finalSlug ,
473+ path : page . fields . slug ,
480474 component : `${ HandbookTemplate } ?__contentFilePath=${ page . internal . contentFilePath } ` ,
481475 context : {
482- slug : finalSlug ,
476+ slug : page . fields . slug ,
483477 } ,
484478 } ) ;
485-
486- // If the source slug contained .html, create a redirect so .html URLs still resolve
487- if ( finalSlug !== page . fields . slug ) {
488- createRedirect ( {
489- fromPath : page . fields . slug ,
490- toPath : finalSlug ,
491- isPermanent : true ,
492- redirectInBrowser : true ,
493- force : true ,
494- } ) ;
495- }
496479 } ) ;
497480
498481
0 commit comments