@@ -15,6 +15,9 @@ const {
1515 getExcludedCollections,
1616 isFullSiteBuild,
1717} = require ( "./src/utils/build-collections" ) ;
18+ const createBlogPages = require ( "./src/node-api/createBlogPages" ) ;
19+ const createKanvasLabPages = require ( "./src/node-api/createKanvasLabPages" ) ;
20+ const createSistentComponentPages = require ( "./src/node-api/createSistentComponentPages" ) ;
1821
1922const shouldBuildFullSite = isFullSiteBuild ( ) ;
2023const excludedCollections = new Set (
@@ -107,23 +110,31 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
107110
108111 const HandbookTemplate = path . resolve ( "src/templates/handbook-template.js" ) ;
109112
113+ await createBlogPages ( {
114+ graphql,
115+ createPage : envCreatePage ,
116+ reporter,
117+ isCollectionEnabled,
118+ blogPostTemplate,
119+ blogCategoryListTemplate,
120+ blogTagListTemplate,
121+ } ) ;
122+
123+ await createKanvasLabPages ( {
124+ graphql,
125+ createPage : envCreatePage ,
126+ reporter,
127+ labTemplate : LabTemplate ,
128+ } ) ;
129+
130+ await createSistentComponentPages ( {
131+ graphql,
132+ createPage,
133+ reporter,
134+ } ) ;
135+
110136 const res = await graphql ( `
111137 {
112- blogPosts: allMdx(
113- filter: {
114- fields: { collection: { eq: "blog" } }
115- frontmatter: { published: { eq: true } }
116- }
117- ) {
118- nodes {
119- fields {
120- slug
121- }
122- internal {
123- contentFilePath
124- }
125- }
126- }
127138 resourcePosts: allMdx(
128139 filter: {
129140 fields: { collection: { eq: "resources" } }
@@ -234,32 +245,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
234245 }
235246 }
236247 }
237- blogTags: allMdx(
238- filter: {
239- fields: { collection: { eq: "blog" } }
240- frontmatter: { published: { eq: true } }
241- }
242- ) {
243- group(field: { frontmatter: { tags: SELECT } }) {
244- nodes {
245- id
246- }
247- fieldValue
248- }
249- }
250- blogCategory: allMdx(
251- filter: {
252- fields: { collection: { eq: "blog" } }
253- frontmatter: { published: { eq: true } }
254- }
255- ) {
256- group(field: { frontmatter: { category: SELECT } }) {
257- nodes {
258- id
259- }
260- fieldValue
261- }
262- }
263248 ${
264249 shouldBuildFullSite
265250 ? `memberPosts: allMdx(
@@ -327,19 +312,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
327312 }
328313 }
329314 }
330- labs: allMdx(
331- filter: { fields: { collection: { eq: "kanvas-labs" } } }
332- ) {
333- nodes {
334- fields {
335- slug
336- collection
337- }
338- internal {
339- contentFilePath
340- }
341- }
342- }
343315 learncontent: allMdx(
344316 filter: { fields: { collection: { eq: "content-learn" } } }
345317 ) {
@@ -358,25 +330,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
358330 }
359331 }
360332 }
361- sistentComponents: allMdx(
362- filter: {
363- fields: { collection: { eq: "sistent" } }
364- }
365- ) {
366- group(field: { fields: { componentName: SELECT } }) {
367- fieldValue
368- nodes {
369- fields {
370- slug
371- componentName
372- pageType
373- }
374- internal {
375- contentFilePath
376- }
377- }
378- }
379- }
380333 }
381334 ` ) ;
382335
@@ -386,7 +339,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
386339 return ;
387340 }
388341
389- const blogs = res . data . blogPosts . nodes ;
390342 const resources = res . data . resourcePosts . nodes ;
391343 const news = res . data . newsPosts . nodes ;
392344
@@ -415,7 +367,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
415367 const handbook = res . data . handbookPages . nodes ;
416368
417369 const singleWorkshop = res . data . singleWorkshop . nodes ;
418- const labs = res . data . labs . nodes ;
419370
420371 if ( isCollectionEnabled ( "events" ) && events . length > 0 ) {
421372 paginate ( {
@@ -427,44 +378,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
427378 } ) ;
428379 }
429380
430- if ( isCollectionEnabled ( "blog" ) ) {
431- blogs . forEach ( ( blog ) => {
432- envCreatePage ( {
433- path : blog . fields . slug ,
434- component : `${ blogPostTemplate } ?__contentFilePath=${ blog . internal . contentFilePath } ` ,
435- context : {
436- slug : blog . fields . slug ,
437- } ,
438- } ) ;
439- } ) ;
440- }
441-
442- const blogCategory = res . data . blogCategory . group ;
443- if ( isCollectionEnabled ( "blog" ) ) {
444- blogCategory . forEach ( ( category ) => {
445- envCreatePage ( {
446- path : `/blog/category/${ slugify ( category . fieldValue ) } ` ,
447- component : blogCategoryListTemplate ,
448- context : {
449- category : category . fieldValue ,
450- } ,
451- } ) ;
452- } ) ;
453- }
454-
455- const BlogTags = res . data . blogTags . group ;
456- if ( isCollectionEnabled ( "blog" ) ) {
457- BlogTags . forEach ( ( tag ) => {
458- envCreatePage ( {
459- path : `/blog/tag/${ slugify ( tag . fieldValue ) } ` ,
460- component : blogTagListTemplate ,
461- context : {
462- tag : tag . fieldValue ,
463- } ,
464- } ) ;
465- } ) ;
466- }
467-
468381 if ( isCollectionEnabled ( "resources" ) ) {
469382 resources . forEach ( ( resource ) => {
470383 envCreatePage ( {
@@ -567,16 +480,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
567480 } ) ;
568481 } ) ;
569482
570- labs . forEach ( ( lab ) => {
571- envCreatePage ( {
572- path : lab . fields . slug ,
573- component : `${ LabTemplate } ?__contentFilePath=${ lab . internal . contentFilePath } ` ,
574- context : {
575- slug : lab . fields . slug ,
576- } ,
577- } ) ;
578- } ) ;
579-
580483 if ( shouldBuildFullSite ) {
581484 integrations . forEach ( ( integration ) => {
582485 envCreatePage ( {
@@ -761,29 +664,6 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
761664 }
762665 } ) ;
763666
764- // Create Sistent component pages dynamically from MDX
765- // Use grouping to identify which sub-pages (Tabs) exist for each component
766- const sistentGroups = res . data . sistentComponents . group ;
767- const sistentTemplate = path . resolve ( "src/templates/sistent-component.js" ) ;
768-
769- sistentGroups . forEach ( ( group ) => {
770- const componentName = group . fieldValue ;
771- // content-learn uses different fields, sistent uses componentName.
772-
773- const availablePages = group . nodes . map ( ( node ) => node . fields . pageType ) ;
774-
775- group . nodes . forEach ( ( node ) => {
776- createPage ( {
777- path : node . fields . slug ,
778- component : `${ sistentTemplate } ?__contentFilePath=${ node . internal . contentFilePath } ` ,
779- context : {
780- slug : node . fields . slug ,
781- componentName : componentName ,
782- availablePages : availablePages ,
783- } ,
784- } ) ;
785- } ) ;
786- } ) ;
787667} ;
788668
789669// slug starts and ends with '/' so parts[0] and parts[-1] will be empty
0 commit comments