@@ -36,7 +36,6 @@ 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 || { } ) } ;
4039 createPage ( page ) ;
4140
4241 createRedirect ( {
@@ -52,58 +51,16 @@ if (process.env.CI === "true") {
5251
5352const { loadRedirects } = require ( "./src/utils/redirects.js" ) ;
5453
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-
6354exports . createPages = async ( { actions, graphql, reporter } ) => {
64- const { createRedirect, createSlice } = actions ;
55+ const { createRedirect } = actions ;
6556 const redirects = loadRedirects ( ) ;
6657 redirects . forEach ( redirect => createRedirect ( redirect ) ) ; // Handles all hardcoded ones dynamically
6758 // Create Pages
6859 const { createPage } = actions ;
6960
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-
9561 const envCreatePage = ( props ) => {
96- const pageConfig = { ...props } ;
97-
98- if ( isDevelopment ) {
99- pageConfig . defer = true ;
100- } else if ( isProduction ) {
101- pageConfig . mode = "SSR" ;
102- }
103- pageConfig . slices = { ...DEFAULT_SLICES , ...( pageConfig . slices || { } ) } ;
104-
10562 if ( process . env . CI === "true" ) {
106- const { path, matchPath, ...rest } = pageConfig ;
63+ const { path, matchPath, ...rest } = props ;
10764
10865 createRedirect ( {
10966 fromPath : `/${ path } /` ,
@@ -118,7 +75,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
11875 ...rest ,
11976 } ) ;
12077 }
121- return createPage ( pageConfig ) ;
78+ return createPage ( props ) ;
12279 } ;
12380
12481 const blogPostTemplate = path . resolve ( "src/templates/blog-single.js" ) ;
@@ -555,7 +512,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
555512 } ) ;
556513
557514 const components = componentsData . map ( ( component ) => component . src . replace ( "/" , "" ) ) ;
558- const createComponentPages = ( envCreatePage , components ) => {
515+ const createComponentPages = ( createPage , components ) => {
559516 const pageTypes = [
560517 { suffix : "" , file : "index.js" } ,
561518 { suffix : "/guidance" , file : "guidance.js" } ,
@@ -568,7 +525,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
568525 const componentPath = `./src/sections/Projects/Sistent/components/${ name } /${ file } ` ;
569526 if ( fs . existsSync ( path . resolve ( componentPath ) ) ) {
570527 try {
571- envCreatePage ( {
528+ createPage ( {
572529 path : pagePath ,
573530 component : require . resolve ( componentPath ) ,
574531 } ) ;
@@ -582,7 +539,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
582539 } ) ;
583540 } ;
584541
585- createComponentPages ( envCreatePage , components ) ;
542+ createComponentPages ( createPage , components ) ;
586543} ;
587544
588545// slug starts and ends with '/' so parts[0] and parts[-1] will be empty
0 commit comments