itwasmattgregg
itwasmattgregg

Reputation: 383

Is there any way to get gatsby-source-filesystem name in gatsby-plugin-mdx query?

I'm using gatsby-plugin-mdx to create pages. But I want to create different kinds of pages based on the folder they are sourced from with gatsby-source-filesystem. I made the name different in the gatsby-source-filesystem config but I can't seem to pass that along to the mdx node. Does anyone know of a way to do this?

Upvotes: 1

Views: 786

Answers (1)

Z. Zlatev
Z. Zlatev

Reputation: 4820

Don't query allMdx directly. Instead do query for allFile using a filter for sourceInstanceName field.

{
  allFile(filter: { sourceInstanceName: { eq: "products" } }) {
    childMdx { ... }
  } 
}

Upvotes: 6

Related Questions