Skip to content

Commit 08312a2

Browse files
gatsby node update
Signed-off-by: Rajesh-Nagarajan-11 <rajeshnagarajan36@gmail.com>
1 parent 0d112d0 commit 08312a2

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

gatsby-node.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
105105
const resourcePostTemplate = path.resolve("src/templates/resource-single.js");
106106
const integrationTemplate = path.resolve("src/templates/integrations.js");
107107

108+
const HandbookTemplate = path.resolve("src/templates/handbook-template.js");
109+
110+
108111
const res = await graphql(`
109112
{
110113
allPosts: allMdx(filter: { frontmatter: { published: { eq: true } } }) {
@@ -122,6 +125,19 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
122125
}
123126
}
124127
}
128+
handbookPages: allMdx(
129+
filter: { fields: { collection: { eq: "handbook" } } }
130+
) {
131+
nodes {
132+
fields {
133+
slug
134+
collection
135+
}
136+
internal {
137+
contentFilePath
138+
}
139+
}
140+
}
125141
blogTags: allMdx(
126142
filter: {
127143
fields: { collection: { eq: "blog" } }
@@ -253,6 +269,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
253269
(nodes) => nodes.fields.collection === "integrations"
254270
);
255271

272+
const handbook = res.data.handbookPages.nodes;
273+
274+
256275
const singleWorkshop = res.data.singleWorkshop.nodes;
257276
const labs = res.data.labs.nodes;
258277

@@ -408,6 +427,17 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
408427
});
409428
});
410429

430+
handbook.forEach((page) => {
431+
envCreatePage({
432+
path: page.fields.slug,
433+
component: `${HandbookTemplate}?__contentFilePath=${page.internal.contentFilePath}`,
434+
context: {
435+
slug: page.fields.slug,
436+
},
437+
});
438+
});
439+
440+
411441
programs.forEach((program) => {
412442
envCreatePage({
413443
path: `/programs/${program.frontmatter.programSlug}`,
@@ -605,6 +635,9 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
605635
if (node.frontmatter.published)
606636
slug = `/community/members/${node.frontmatter.permalink ?? slugify(node.frontmatter.name)}`;
607637
break;
638+
case "handbook":
639+
slug = `/community/handbook/${slugify(node.frontmatter.title)}`;
640+
break;
608641
case "events":
609642
if (node.frontmatter.title)
610643
slug = `/community/events/${slugify(node.frontmatter.title)}`;

0 commit comments

Comments
 (0)