Skip to content

Commit 283c8ce

Browse files
looking in gatsby-node
1 parent 7d1f8be commit 283c8ce

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

packages/gatsby-theme/gatsby-node.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// const componentWithMDXScope = require('gatsby-mdx/component-with-mdx-scope');
22
const {
33
getTutorialSlug,
4-
getTutorialOverviewSlug,
5-
} = require('./src/utils/getTutorialSlug.js');
4+
getTutorialOverviewSlug
5+
} = require("./src/utils/getTutorialSlug.js");
66

77
exports.createPages = async ({ graphql, actions }) => {
88
const { createPage } = actions;
99
const TutorialLayout = require.resolve(
10-
`./src/components/templates/Tutorial.tsx`,
10+
`./src/components/templates/Tutorial.tsx`
1111
);
1212

1313
const { data } = await graphql(`
@@ -33,7 +33,7 @@ exports.createPages = async ({ graphql, actions }) => {
3333
const tutorialPath = getTutorialSlug(node.fileAbsolutePath);
3434
const overviewPageSlug = getTutorialOverviewSlug(node.fileAbsolutePath);
3535
const overviewTemplate = require.resolve(
36-
'./src/components/templates/TutorialOverview.tsx',
36+
"./src/components/templates/TutorialOverview.tsx"
3737
);
3838
//TODO: find a better way to ID posts & overviews Also a better way to query for them
3939
if (node.frontmatter.tutorialTitle) {
@@ -42,17 +42,18 @@ exports.createPages = async ({ graphql, actions }) => {
4242
component: overviewTemplate,
4343
context: {
4444
id: node.id,
45-
folderRegex: `/(${overviewPageSlug})/`,
46-
},
45+
folderRegex: `/(${overviewPageSlug})/`
46+
}
4747
});
4848
}
49+
console.log(overviewPageSlug);
4950
createPage({
5051
path: tutorialPath,
5152
component: TutorialLayout, // node.fileAbsolutePath,
5253
context: {
5354
id: node.id,
54-
folderRegex: `/(${overviewPageSlug})/`,
55-
},
55+
folderRegex: `/(${overviewPageSlug})/`
56+
}
5657
});
5758
});
5859
};

packages/gatsby-theme/src/components/templates/Tutorial.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const TutorialLayout: React.FunctionComponent<TutorialLayoutProps> = ({
1818
if (!data) {
1919
return null;
2020
}
21-
console.log(JSON.stringify(data.tutorialTitle, null, 2));
21+
console.log(Object.keys(data), JSON.stringify(data.tutorialTitle, null, 2));
2222
const { pageTitle } = data!.mdx!.frontmatter!;
2323
const tutorialTitle = optionalChaining(() => data!.tutorialTitle!.frontmatter!.tutorialTitle!);
2424
const chapters = optionalChaining(() => data!.pageTitles!.edges!.map(

0 commit comments

Comments
 (0)