@@ -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,16 +50,52 @@ 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 } ) => {
53- const { createRedirect } = actions ;
62+ const { createRedirect, createSlice } = actions ;
5463 const redirects = loadRedirects ( ) ;
5564 redirects . forEach ( redirect => createRedirect ( redirect ) ) ; // Handles all hardcoded ones dynamically
5665 // Create Pages
5766 const { createPage } = actions ;
5867
68+ createSlice ( {
69+ id : "site-header" ,
70+ component : path . resolve ( "./src/slices/site-header.js" ) ,
71+ } ) ;
72+
73+ createSlice ( {
74+ id : "site-footer" ,
75+ component : path . resolve ( "./src/slices/site-footer.js" ) ,
76+ } ) ;
77+
78+ createSlice ( {
79+ id : "cta-bottom" ,
80+ component : path . resolve ( "./src/slices/cta-bottom.js" ) ,
81+ } ) ;
82+
83+ createSlice ( {
84+ id : "cta-fullwidth" ,
85+ component : path . resolve ( "./src/slices/cta-fullwidth.js" ) ,
86+ } ) ;
87+
88+ createSlice ( {
89+ id : "cta-imageonly" ,
90+ component : path . resolve ( "./src/slices/cta-imageonly.js" ) ,
91+ } ) ;
92+
5993 const envCreatePage = ( props ) => {
94+ const pageConfig = { ...props } ;
95+ pageConfig . slices = { ...DEFAULT_SLICES , ...( pageConfig . slices || { } ) } ;
96+
6097 if ( process . env . CI === "true" ) {
61- const { path, matchPath, ...rest } = props ;
98+ const { path, matchPath, ...rest } = pageConfig ;
6299
63100 createRedirect ( {
64101 fromPath : `/${ path } /` ,
@@ -73,7 +110,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
73110 ...rest ,
74111 } ) ;
75112 }
76- return createPage ( props ) ;
113+ return createPage ( pageConfig ) ;
77114 } ;
78115
79116 const blogPostTemplate = path . resolve ( "src/templates/blog-single.js" ) ;
@@ -510,7 +547,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
510547 } ) ;
511548
512549 const components = componentsData . map ( ( component ) => component . src . replace ( "/" , "" ) ) ;
513- const createComponentPages = ( createPage , components ) => {
550+ const createComponentPages = ( envCreatePage , components ) => {
514551 const pageTypes = [
515552 { suffix : "" , file : "index.js" } ,
516553 { suffix : "/guidance" , file : "guidance.js" } ,
@@ -523,7 +560,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
523560 const componentPath = `./src/sections/Projects/Sistent/components/${ name } /${ file } ` ;
524561 if ( fs . existsSync ( path . resolve ( componentPath ) ) ) {
525562 try {
526- createPage ( {
563+ envCreatePage ( {
527564 path : pagePath ,
528565 component : require . resolve ( componentPath ) ,
529566 } ) ;
@@ -537,7 +574,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
537574 } ) ;
538575 } ;
539576
540- createComponentPages ( createPage , components ) ;
577+ createComponentPages ( envCreatePage , components ) ;
541578} ;
542579
543580// slug starts and ends with '/' so parts[0] and parts[-1] will be empty
0 commit comments