Skip to content

Exposes a new node field called name to allow filtering of separate folders using the gatsby-source-filesystem plugin

License

Notifications You must be signed in to change notification settings

terryjbutler/gatsby-source-filesystem-markdown-name

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gatsby-source-filesystem-markdown-name

Adds a new node field called "name" designed to filter on a directory referenced by gatsby-source-filesystem:

Install

npm i gatsby-source-filesystem-markdown-name

or

yarn add gatsby-source-filesystem-markdown-name

Example gatsby-config.js

  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/src/content/posts/`,
        name: 'posts',
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/src/content/pages/`,
        name: 'pages',
      },
    },
    'gatsby-source-filesystem-markdown-name',
  ]

Example GraphQL Query

query MyQuery {
  allMarkdownRemark(filter: {fields: {sourceName: {eq: "posts"}}}) {
    edges {
      node {
        fields {
          slug
          sourceName
        }
      }
    }
  }
}

About

Exposes a new node field called name to allow filtering of separate folders using the gatsby-source-filesystem plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published