0
votes

I am using the Gatsby develop graphiql sandbox to test some queries, I have a working query that is pulling markdown files using the gatsby-transformer-remark plugin. My markdown files are located in src/posts/post-1.md these are returned in my query below, however I started to use Netlifys cms to create markdown files, and the way I set it up the markdown files are located in src/team/post-1.md Now this markdown file is not returned in the query, so it makes me think the default allMarkdownRemark query requires the markdown files to be in the src/posts folder is there a way to overwrite this and point to the src/team folder Ok that just about covers it here is my query.

query BlogPostArchive1 {
    allMarkdownRemark(
      limit: 10
      sort: { order: DESC, fields: [frontmatter___date] }
    ) {
      edges {
        node {
          excerpt
          frontmatter {
            title
            slug
            date(formatString: "MMMM DD, YYYY")
          }
        }
      }
    }
  }
1

1 Answers

1
votes

gatsby-transformer-remark is a transformer plugin, which means that its only job is to parse and transform markdown.

Before it can do this, you need to tell it where to find the markdown files. This is where source plugins come in.

In your case, you are sourcing your markdown from within your filesystem (as opposed to an external source). The plugin you are looking for is gatsby-source-filesystem.

Since you used to be able to query markdown, you must already have gatsby-source-filesystem installed.

I think that the issue is the plugin's configuration: currently it is not looking into your src/team/ directory.

Check your gatsby-config.js for code looking like this:

{
  resolve: `gatsby-source-filesystem`,
  options: {
    name: `posts`,
    path: `${__dirname}/src/posts/`,
  },
},

Try to change the path line to:

    path: `${__dirname}/src/team/`,

Then make sure to rebuild your site.

Does it do the trick?