How to filter allMarkdownRemark by folder (Gatsby and GraphQl)
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src/pages/`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `posts`,
path: `${__dirname}/src/posts/`,
},
},
Here, the name will not be used; instead, the parent folder will be used.
query MyQuery {
allMarkdownRemark(filter: {fileAbsolutePath: {regex: "/(posts)/" }}) {
nodes {
id
}
}
}