@@ -34,6 +34,7 @@ if (process.env.CI === "true") {
3434 if ( page . path !== oldPage . path ) {
3535 // Replace new page with old page
3636 deletePage ( oldPage ) ;
37+ page . slices = { ...DEFAULT_SLICES , ...( page . slices || { } ) } ;
3738 createPage ( page ) ;
3839
3940 createRedirect ( {
@@ -49,6 +50,14 @@ if (process.env.CI === "true") {
4950
5051const { loadRedirects } = require ( "./src/utils/redirects.js" ) ;
5152
53+ const DEFAULT_SLICES = {
54+ "site-header" : "site-header" ,
55+ "site-footer" : "site-footer" ,
56+ "cta-bottom" : "cta-bottom" ,
57+ "cta-fullwidth" : "cta-fullwidth" ,
58+ "cta-imageonly" : "cta-imageonly" ,
59+ } ;
60+
5261exports . createPages = async ( { actions, graphql, reporter } ) => {
5362 const { createRedirect, createSlice } = actions ;
5463 const redirects = loadRedirects ( ) ;
@@ -82,8 +91,11 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
8291 } ) ;
8392
8493 const envCreatePage = ( props ) => {
94+ const pageConfig = { ...props } ;
95+ pageConfig . slices = { ...DEFAULT_SLICES , ...( pageConfig . slices || { } ) } ;
96+
8597 if ( process . env . CI === "true" ) {
86- const { path, matchPath, ...rest } = props ;
98+ const { path, matchPath, ...rest } = pageConfig ;
8799
88100 createRedirect ( {
89101 fromPath : `/${ path } /` ,
@@ -98,7 +110,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
98110 ...rest ,
99111 } ) ;
100112 }
101- return createPage ( props ) ;
113+ return createPage ( pageConfig ) ;
102114 } ;
103115
104116 const blogPostTemplate = path . resolve ( "src/templates/blog-single.js" ) ;
@@ -535,7 +547,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
535547 } ) ;
536548
537549 const components = componentsData . map ( ( component ) => component . src . replace ( "/" , "" ) ) ;
538- const createComponentPages = ( createPage , components ) => {
550+ const createComponentPages = ( envCreatePage , components ) => {
539551 const pageTypes = [
540552 { suffix : "" , file : "index.js" } ,
541553 { suffix : "/guidance" , file : "guidance.js" } ,
@@ -548,7 +560,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
548560 const componentPath = `./src/sections/Projects/Sistent/components/${ name } /${ file } ` ;
549561 if ( fs . existsSync ( path . resolve ( componentPath ) ) ) {
550562 try {
551- createPage ( {
563+ envCreatePage ( {
552564 path : pagePath ,
553565 component : require . resolve ( componentPath ) ,
554566 } ) ;
@@ -562,7 +574,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
562574 } ) ;
563575 } ;
564576
565- createComponentPages ( createPage , components ) ;
577+ createComponentPages ( envCreatePage , components ) ;
566578} ;
567579
568580// slug starts and ends with '/' so parts[0] and parts[-1] will be empty
0 commit comments