gatsby-source-filesystem-markdown-name

1.0.1 • Public • Published

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
        }
      }
    }
  }
}

/gatsby-source-filesystem-markdown-name/

    Package Sidebar

    Install

    npm i gatsby-source-filesystem-markdown-name

    Weekly Downloads

    22

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.24 kB

    Total Files

    5

    Last publish

    Collaborators

    • terryjb