diff --git a/packages/gatsby-theme-egghead-blog/gatsby-node.js b/packages/gatsby-theme-egghead-blog/gatsby-node.js index 5102e60..3eab44f 100644 --- a/packages/gatsby-theme-egghead-blog/gatsby-node.js +++ b/packages/gatsby-theme-egghead-blog/gatsby-node.js @@ -184,5 +184,11 @@ exports.onCreateNode = ({ node, getNode, actions }) => { node, value: node.frontmatter.redirects, }) + + createNodeField({ + name: 'isPost', + node, + value: true, + }) } } diff --git a/packages/gatsby-theme-egghead-blog/src/templates/blog.js b/packages/gatsby-theme-egghead-blog/src/templates/blog.js index 46e1ecc..c471875 100644 --- a/packages/gatsby-theme-egghead-blog/src/templates/blog.js +++ b/packages/gatsby-theme-egghead-blog/src/templates/blog.js @@ -18,8 +18,7 @@ const Blog = ({ .map(id => allMdx.edges.find( edge => - edge.node.id === id && - edge.node.parent.sourceInstanceName !== 'pages', + edge.node.id === id ), ) .filter(post => post !== undefined) @@ -131,7 +130,10 @@ export const pageQuery = graphql` site { ...site } - allMdx(sort: { fields: [frontmatter___date], order: DESC }) { + allMdx( + sort: { fields: [frontmatter___date], order: DESC } + filter: { fields: { isPost: { eq: true } } } + ) { edges { node { excerpt(pruneLength: 300) @@ -141,11 +143,6 @@ export const pageQuery = graphql` slug date } - parent { - ... on File { - sourceInstanceName - } - } frontmatter { title date(formatString: "MMMM DD, YYYY")