@@ -11,8 +11,6 @@ const slugify = require("./src/utils/slugify");
1111const { paginate } = require ( "gatsby-awesome-pagination" ) ;
1212const { createFilePath } = require ( "gatsby-source-filesystem" ) ;
1313const config = require ( "./gatsby-config" ) ;
14- const isDevelopment = process . env . NODE_ENV === "development" ;
15- const isProduction = process . env . NODE_ENV === "production" ;
1614const {
1715 componentsData,
1816} = require ( "./src/sections/Projects/Sistent/components/content" ) ;
@@ -21,34 +19,6 @@ const HEAVY_COLLECTIONS = new Set(["members", "integrations"]);
2119const isFullSiteBuild = process . env . BUILD_FULL_SITE !== "false" ;
2220const shouldIncludeCollection = ( collection ) => isFullSiteBuild || ! HEAVY_COLLECTIONS . has ( collection ) ;
2321
24- if ( process . env . CI === "true" ) {
25- // All process.env.CI conditionals in this file are in place for GitHub Pages, if webhost changes in the future, code may need to be modified or removed.
26- //Replacing '/' would result in empty string which is invalid
27- const replacePath = ( url ) =>
28- url === "/" || url . includes ( "/404" ) || url . endsWith ( ".html" ) ? url : `${ url } .html` ;
29-
30- exports . onCreatePage = ( { page, actions } ) => {
31- const { createPage, deletePage, createRedirect } = actions ;
32- const oldPage = Object . assign ( { } , page ) ;
33- page . matchPath = page . path ;
34- page . path = replacePath ( page . path ) ;
35-
36- if ( page . path !== oldPage . path ) {
37- // Replace new page with old page
38- deletePage ( oldPage ) ;
39- createPage ( page ) ;
40-
41- createRedirect ( {
42- fromPath : `/${ page . matchPath } /` ,
43- toPath : `/${ page . matchPath } ` ,
44- redirectInBrowser : true ,
45- isPermanent : true ,
46- } ) ;
47- }
48- } ;
49- }
50-
51-
5222const { loadRedirects } = require ( "./src/utils/redirects.js" ) ;
5323
5424exports . createPages = async ( { actions, graphql, reporter } ) => {
@@ -59,23 +29,22 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
5929 const { createPage } = actions ;
6030
6131 const envCreatePage = ( props ) => {
32+ const pageProps = {
33+ ...props ,
34+ matchPath : props . matchPath || props . path ,
35+ } ;
36+
6237 if ( process . env . CI === "true" ) {
63- const { path, matchPath, ...rest } = props ;
64- const isHandbookPage = path . startsWith ( "/community/handbook/" ) ;
38+ const { path } = pageProps ;
6539 createRedirect ( {
6640 fromPath : `/${ path } /` ,
6741 toPath : `/${ path } ` ,
6842 redirectInBrowser : true ,
6943 isPermanent : true ,
7044 } ) ;
71-
72- return createPage ( {
73- path : isHandbookPage ? path : `${ path } .html` ,
74- matchPath : matchPath || path ,
75- ...rest ,
76- } ) ;
7745 }
78- return createPage ( props ) ;
46+
47+ return createPage ( pageProps ) ;
7948 } ;
8049
8150 const blogPostTemplate = path . resolve ( "src/templates/blog-single.js" ) ;
@@ -260,6 +229,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
260229 } ;
261230
262231 const blogs = filterByCollection ( "blog" ) ;
232+
263233 const resources = filterByCollection ( "resources" ) ;
264234 const news = filterByCollection ( "news" ) ;
265235 const books = filterByCollection ( "service-mesh-books" ) ;
@@ -358,9 +328,10 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
358328 programs . forEach ( ( program ) => {
359329 envCreatePage ( {
360330 path : program . fields . slug ,
361- component : `${ ProgramPostTemplate } ?__contentFilePath=${ program . internal . contentFilePath } ` ,
331+ component : `${ MultiProgramPostTemplate } ?__contentFilePath=${ program . internal . contentFilePath } ` ,
362332 context : {
363333 slug : program . fields . slug ,
334+ program : program . frontmatter . program ,
364335 } ,
365336 } ) ;
366337 } ) ;
@@ -690,11 +661,11 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
690661 case "kanvas-labs" :
691662 slug = `/learn/${ collection } /${ slugify ( node . frontmatter . title ) } ` ;
692663 break ;
693- case "resources" :
694- if ( node . frontmatter . published )
695- slug = `/${ collection } /${ slugify (
696- node . frontmatter . category
697- ) } /${ slugify ( node . frontmatter . title ) } `;
664+ case "resources" :
665+ if ( node . frontmatter . published )
666+ slug = `/${ collection } /${ slugify (
667+ node . frontmatter . category
668+ ) } /${ slugify ( node . frontmatter . title ) } `;
698669 break ;
699670 case "members" :
700671 if ( node . frontmatter . published )
@@ -766,7 +737,7 @@ const createCoursesListPage = ({ envCreatePage, node }) => {
766737} ;
767738
768739const createCourseOverviewPage = ( { envCreatePage, node } ) => {
769- const { learnpath, slug, course, pageType, permalink, section } = node . fields ;
740+ const { learnpath, slug, course, pageType, permalink, section } = node . fields ;
770741
771742 envCreatePage ( {
772743 path : `${ slug } ` ,
0 commit comments