File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed
src/pages/office-utilization/[location] Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -561,13 +561,29 @@ const OfficeUtilizationPage = (
561561 ) ;
562562} ;
563563
564- export const getStaticPaths = ( async ( ) => {
564+ export const getStaticPaths = ( async ( props ) => {
565+ const { locales } = props ;
565566 const records = await getOfficeUtilizationData ( ) ;
566- const paths = records . map ( ( record ) => ( {
567- params : {
568- location : kebabCase ( record . city . toLowerCase ( ) ) ,
569- } ,
570- } ) ) ;
567+ const paths = records . flatMap ( ( record ) => {
568+ const transformedRecord = {
569+ params : {
570+ location : kebabCase ( record . city . toLowerCase ( ) ) ,
571+ } ,
572+ } ;
573+
574+ if ( ! locales ) {
575+ return transformedRecord ;
576+ }
577+ return locales . map ( ( locale ) => {
578+ if ( locale === "en" ) {
579+ return transformedRecord ;
580+ }
581+ return {
582+ ...transformedRecord ,
583+ locale : locale ,
584+ } ;
585+ } ) ;
586+ } ) ;
571587
572588 return {
573589 paths : paths ,
You can’t perform that action at this time.
0 commit comments