diff --git a/blog/test-entry.md b/blog/test-entry.md new file mode 100644 index 0000000..5d93558 --- /dev/null +++ b/blog/test-entry.md @@ -0,0 +1,7 @@ +--- +title: Test Entry +date: '1970-01-01T22:45:00-01:00' +description: 'testing the log posts' +--- + +# This is a test diff --git a/gatsby-config.js b/gatsby-config.js index 0564c1b..e8595cf 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -14,6 +14,13 @@ module.exports = { path: `${__dirname}/src/pages`, }, }, + { + resolve: `gatsby-source-filesystem`, + options: { + name: `blog`, + path: `${__dirname}/blog`, + }, + }, { resolve: `gatsby-plugin-mdx`, options: { diff --git a/gatsby-node.js b/gatsby-node.js index 919ce9b..d82229f 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -7,7 +7,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => { const result = await graphql(` { - allMdx(limit: 1000) { + allMdx(limit: 1000, filter: { fields: { source: { eq: "pages" } } }) { edges { node { frontmatter { @@ -36,11 +36,24 @@ exports.createPages = async ({ actions, graphql, reporter }) => { }) } +exports.onCreateNode = ({ node, getNode, actions }) => { + const { createNodeField } = actions + + if (node.internal.type === `Mdx`) { + const value = getNode(node.parent).sourceInstanceName + createNodeField({ + node, + name: `source`, + value, + }) + } +} + exports.createSchemaCustomization = ({ actions }) => { const { createTypes } = actions const typeDefs = ` type Mdx implements Node { - frontmatter: Frontmatter + frontmatter: Frontmatter } type Frontmatter {