@@ -36,6 +36,7 @@ if (process.env.CI === "true") {
3636 if ( page . path !== oldPage . path ) {
3737 // Replace new page with old page
3838 deletePage ( oldPage ) ;
39+ page . slices = { ...DEFAULT_SLICES , ...( page . slices || { } ) } ;
3940 createPage ( page ) ;
4041
4142 createRedirect ( {
@@ -51,13 +52,46 @@ if (process.env.CI === "true") {
5152
5253const { loadRedirects } = require ( "./src/utils/redirects.js" ) ;
5354
55+ const DEFAULT_SLICES = {
56+ "site-header" : "site-header" ,
57+ "site-footer" : "site-footer" ,
58+ "cta-bottom" : "cta-bottom" ,
59+ "cta-fullwidth" : "cta-fullwidth" ,
60+ "cta-imageonly" : "cta-imageonly" ,
61+ } ;
62+
5463exports . createPages = async ( { actions, graphql, reporter } ) => {
55- const { createRedirect } = actions ;
64+ const { createRedirect, createSlice } = actions ;
5665 const redirects = loadRedirects ( ) ;
5766 redirects . forEach ( redirect => createRedirect ( redirect ) ) ; // Handles all hardcoded ones dynamically
5867 // Create Pages
5968 const { createPage } = actions ;
6069
70+ createSlice ( {
71+ id : "site-header" ,
72+ component : path . resolve ( "./src/slices/site-header.js" ) ,
73+ } ) ;
74+
75+ createSlice ( {
76+ id : "site-footer" ,
77+ component : path . resolve ( "./src/slices/site-footer.js" ) ,
78+ } ) ;
79+
80+ createSlice ( {
81+ id : "cta-bottom" ,
82+ component : path . resolve ( "./src/slices/cta-bottom.js" ) ,
83+ } ) ;
84+
85+ createSlice ( {
86+ id : "cta-fullwidth" ,
87+ component : path . resolve ( "./src/slices/cta-fullwidth.js" ) ,
88+ } ) ;
89+
90+ createSlice ( {
91+ id : "cta-imageonly" ,
92+ component : path . resolve ( "./src/slices/cta-imageonly.js" ) ,
93+ } ) ;
94+
6195 const envCreatePage = ( props ) => {
6296 const pageConfig = { ...props } ;
6397
@@ -66,6 +100,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
66100 } else if ( isProduction ) {
67101 pageConfig . mode = "SSR" ;
68102 }
103+ pageConfig . slices = { ...DEFAULT_SLICES , ...( pageConfig . slices || { } ) } ;
69104
70105 if ( process . env . CI === "true" ) {
71106 const { path, matchPath, ...rest } = pageConfig ;
@@ -520,7 +555,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
520555 } ) ;
521556
522557 const components = componentsData . map ( ( component ) => component . src . replace ( "/" , "" ) ) ;
523- const createComponentPages = ( createPage , components ) => {
558+ const createComponentPages = ( envCreatePage , components ) => {
524559 const pageTypes = [
525560 { suffix : "" , file : "index.js" } ,
526561 { suffix : "/guidance" , file : "guidance.js" } ,
@@ -533,7 +568,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
533568 const componentPath = `./src/sections/Projects/Sistent/components/${ name } /${ file } ` ;
534569 if ( fs . existsSync ( path . resolve ( componentPath ) ) ) {
535570 try {
536- createPage ( {
571+ envCreatePage ( {
537572 path : pagePath ,
538573 component : require . resolve ( componentPath ) ,
539574 } ) ;
0 commit comments