Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

Gatsby Plugin: Add SourceInstanceName to MarkdownRemark

MIT License CircleCI NPM

Add the options.name value from gatsby-source-filesystem to MarkdownRemark nodes for better filtering of different content types.

Install

# With Yarn
$ > yarn add -D gatsby-source-instance-name-for-remark

# With NPM
$ > npm install --save-dev gatsby-source-instance-name-for-remark

Configuration

// gatsby-config.js

module.exports = {
  siteMetadata: {
    title: "Gatsby Default Starter"
  },
  plugins: [
    {
      resolve: "gatsby-source-filesystem",
      options: {
        path: `${__dirname}/pages`,
        name: "pages"
      }
    },
    {
      resolve: "gatsby-source-filesystem",
      options: {
        path: `${__dirname}/products`,
        name: "products"
      }
    },
    "gatsby-transformer-remark",
    "gatsby-source-instance-name-for-remark"
  ]
};

License

Feel free to use the code, it’s released using the MIT license.

Contribution

You are welcome to contribute to this project! 😘

To make sure you have a pleasant experience, please read the code of conduct. It outlines core values and beliefs and will make working together a happier experience.

© 2023 Gatsby, Inc.