@@ -15,6 +15,10 @@ const {
1515 componentsData,
1616} = require ( "./src/sections/Projects/Sistent/components/content" ) ;
1717
18+ const HEAVY_COLLECTIONS = new Set ( [ "members" , "integrations" ] ) ;
19+ const isFullSiteBuild = process . env . BUILD_FULL_SITE !== "false" ;
20+ const shouldIncludeCollection = ( collection ) => isFullSiteBuild || ! HEAVY_COLLECTIONS . has ( collection ) ;
21+
1822if ( process . env . CI === "true" ) {
1923 // 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.
2024 //Replacing '/' would result in empty string which is invalid
@@ -105,6 +109,31 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
105109 const resourcePostTemplate = path . resolve ( "src/templates/resource-single.js" ) ;
106110 const integrationTemplate = path . resolve ( "src/templates/integrations.js" ) ;
107111
112+ const memberBioQuery = isFullSiteBuild
113+ ? `
114+ memberBio: allMdx(
115+ filter: {
116+ fields: { collection: { eq: "members" } }
117+ frontmatter: { published: { eq: true }, executive_bio: { eq: true } }
118+ }
119+ ) {
120+ nodes {
121+ frontmatter {
122+ name
123+ permalink
124+ }
125+ fields {
126+ slug
127+ collection
128+ }
129+ internal {
130+ contentFilePath
131+ }
132+ }
133+ }
134+ `
135+ : "" ;
136+
108137 const res = await graphql ( `
109138 {
110139 allPosts: allMdx(filter: { frontmatter: { published: { eq: true } } }) {
@@ -148,26 +177,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
148177 fieldValue
149178 }
150179 }
151- memberBio: allMdx(
152- filter: {
153- fields: { collection: { eq: "members" } }
154- frontmatter: { published: { eq: true }, executive_bio: { eq: true } }
155- }
156- ) {
157- nodes {
158- frontmatter {
159- name
160- permalink
161- }
162- fields {
163- slug
164- collection
165- }
166- internal {
167- contentFilePath
168- }
169- }
170- }
180+ ${ memberBioQuery }
171181 singleWorkshop: allMdx(
172182 filter: { fields: { collection: { eq: "workshops" } } }
173183 ) {
@@ -223,35 +233,22 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
223233
224234 const allNodes = res . data . allPosts . nodes ;
225235
226- const blogs = allNodes . filter ( ( node ) => node . fields . collection === "blog" ) ;
227-
228- const resources = allNodes . filter (
229- ( node ) => node . fields . collection === "resources"
230- ) ;
231-
232- const news = allNodes . filter ( ( node ) => node . fields . collection === "news" ) ;
233-
234- const books = allNodes . filter (
235- ( node ) => node . fields . collection === "service-mesh-books"
236- ) ;
237-
238- const events = allNodes . filter ( ( node ) => node . fields . collection === "events" ) ;
239-
240- const programs = allNodes . filter (
241- ( node ) => node . fields . collection === "programs"
242- ) ;
243-
244- const careers = allNodes . filter (
245- ( node ) => node . fields . collection === "careers"
246- ) ;
247-
248- const members = allNodes . filter (
249- ( node ) => node . fields . collection === "members"
250- ) ;
236+ const filterByCollection = ( collection ) => {
237+ if ( ! shouldIncludeCollection ( collection ) ) {
238+ return [ ] ;
239+ }
240+ return allNodes . filter ( ( node ) => node . fields . collection === collection ) ;
241+ } ;
251242
252- const integrations = allNodes . filter (
253- ( nodes ) => nodes . fields . collection === "integrations"
254- ) ;
243+ const blogs = filterByCollection ( "blog" ) ;
244+ const resources = filterByCollection ( "resources" ) ;
245+ const news = filterByCollection ( "news" ) ;
246+ const books = filterByCollection ( "service-mesh-books" ) ;
247+ const events = filterByCollection ( "events" ) ;
248+ const programs = filterByCollection ( "programs" ) ;
249+ const careers = filterByCollection ( "careers" ) ;
250+ const members = filterByCollection ( "members" ) ;
251+ const integrations = filterByCollection ( "integrations" ) ;
255252
256253 const singleWorkshop = res . data . singleWorkshop . nodes ;
257254 const labs = res . data . labs . nodes ;
@@ -356,26 +353,30 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
356353 } ) ;
357354 } ) ;
358355
359- members . forEach ( ( member ) => {
360- envCreatePage ( {
361- path : member . fields . slug ,
362- component : `${ MemberTemplate } ?__contentFilePath=${ member . internal . contentFilePath } ` ,
363- context : {
364- slug : member . fields . slug ,
365- } ,
356+ if ( isFullSiteBuild ) {
357+ members . forEach ( ( member ) => {
358+ envCreatePage ( {
359+ path : member . fields . slug ,
360+ component : `${ MemberTemplate } ?__contentFilePath=${ member . internal . contentFilePath } ` ,
361+ context : {
362+ slug : member . fields . slug ,
363+ } ,
364+ } ) ;
366365 } ) ;
367- } ) ;
366+ }
368367
369- const MemberBio = res . data . memberBio . nodes ;
370- MemberBio . forEach ( ( memberbio ) => {
371- envCreatePage ( {
372- path : `${ memberbio . fields . slug } /bio` ,
373- component : `${ MemberBioTemplate } ?__contentFilePath=${ memberbio . internal . contentFilePath } ` ,
374- context : {
375- member : memberbio . frontmatter . name ,
376- } ,
368+ const MemberBio = res . data . memberBio ?. nodes || [ ] ;
369+ if ( isFullSiteBuild ) {
370+ MemberBio . forEach ( ( memberbio ) => {
371+ envCreatePage ( {
372+ path : `${ memberbio . fields . slug } /bio` ,
373+ component : `${ MemberBioTemplate } ?__contentFilePath=${ memberbio . internal . contentFilePath } ` ,
374+ context : {
375+ member : memberbio . frontmatter . name ,
376+ } ,
377+ } ) ;
377378 } ) ;
378- } ) ;
379+ }
379380
380381 singleWorkshop . forEach ( ( workshop ) => {
381382 envCreatePage ( {
@@ -397,16 +398,18 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
397398 } ) ;
398399 } ) ;
399400
400- integrations . forEach ( ( integration ) => {
401- envCreatePage ( {
402- path : `/cloud-native-management/meshery${ integration . fields . slug } ` ,
403- component : `${ integrationTemplate } ?__contentFilePath=${ integration . internal . contentFilePath } ` ,
404- context : {
405- slug : integration . fields . slug ,
406- name : "_images/" + integration . fields . slug . split ( "/" ) [ 2 ] ,
407- } ,
401+ if ( isFullSiteBuild ) {
402+ integrations . forEach ( ( integration ) => {
403+ envCreatePage ( {
404+ path : `/cloud-native-management/meshery${ integration . fields . slug } ` ,
405+ component : `${ integrationTemplate } ?__contentFilePath=${ integration . internal . contentFilePath } ` ,
406+ context : {
407+ slug : integration . fields . slug ,
408+ name : "_images/" + integration . fields . slug . split ( "/" ) [ 2 ] ,
409+ } ,
410+ } ) ;
408411 } ) ;
409- } ) ;
412+ }
410413
411414 programs . forEach ( ( program ) => {
412415 envCreatePage ( {
@@ -418,6 +421,35 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
418421 } ) ;
419422 } ) ;
420423
424+ if ( ! isFullSiteBuild ) {
425+ const placeholderPages = [
426+ {
427+ path : "/__placeholders/integration" ,
428+ component : integrationTemplate ,
429+ context : {
430+ slug : "/integrations/__placeholder__" ,
431+ name : "__placeholder__" ,
432+ } ,
433+ } ,
434+ {
435+ path : "/__placeholders/member" ,
436+ component : MemberTemplate ,
437+ context : {
438+ slug : "/members/__placeholder__" ,
439+ } ,
440+ } ,
441+ {
442+ path : "/__placeholders/executive-bio" ,
443+ component : MemberBioTemplate ,
444+ context : {
445+ member : "__placeholder__" ,
446+ } ,
447+ } ,
448+ ] ;
449+
450+ placeholderPages . forEach ( ( page ) => envCreatePage ( page ) ) ;
451+ }
452+
421453 const learnNodes = res . data . learncontent . nodes ;
422454
423455 learnNodes . forEach ( ( node ) => {
@@ -753,26 +785,60 @@ exports.createSchemaCustomization = ({ actions }) => {
753785 type Mdx implements Node {
754786 frontmatter: Frontmatter
755787 }
788+
789+ type FrontmatterComponent {
790+ name: String
791+ description: String
792+ colorIcon: File @fileByRelativePath
793+ whiteIcon: File @fileByRelativePath
794+ }
795+
756796 type Frontmatter {
757- subtitle: String,
758- abstract: String,
759- eurl: String,
760- twitter: String,
761- github: String,
762- layer5: String,
763- meshmate: String,
764- maintainer:String,
765- emeritus: String,
766- link: String,
767- labs: String,
768- slides: String,
769- slack: String,
770- video: String,
771- community_manager: String,
772- docURL: String,
773- permalink: String,
774- slug: String,
797+ title: String
798+ subtitle: String
799+ abstract: String
800+ description: String
801+ eurl: String
802+ twitter: String
803+ github: String
804+ layer5: String
805+ meshmate: String
806+ maintainer: String
807+ emeritus: String
808+ link: String
809+ labs: String
810+ slides: String
811+ slack: String
812+ video: String
813+ community_manager: String
814+ docURL: String
815+ permalink: String
816+ slug: String
775817 redirect_from: [String]
818+ category: String
819+ subcategory: String
820+ registrant: String
821+ featureList: [String]
822+ howItWorks: String
823+ howItWorksDetails: String
824+ components: [FrontmatterComponent]
825+ integrationIcon: File @fileByRelativePath
826+ darkModeIntegrationIcon: File @fileByRelativePath
827+ workingSlides: [File] @fileByRelativePath
828+ name: String
829+ position: String
830+ email: String
831+ profile: String
832+ linkedin: String
833+ location: String
834+ badges: [String]
835+ status: String
836+ bio: String
837+ executive_bio: String
838+ executive_position: String
839+ company: String
840+ executive_image: File @fileByRelativePath
841+ image_path: File @fileByRelativePath
776842 }
777843 ` ;
778844 createTypes ( typeDefs ) ;
0 commit comments