Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-folder-metadata

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-folder-metadata

While building a large and complex website, I ran into a situation where I wanted to be able to have metadata that applied to every file within a folder. This plugin reads in `metadata.json` files and adds them to the `metadata.data` field on Gatsby `File

  • 0.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gatsby-plugin-folder-metadata

While building a large and complex website, I ran into a situation where I wanted to be able to have metadata that applied to every file within a folder. This plugin reads in metadata.json files and adds them to the metadata.data field on Gatsby File nodes.

If a parent folder has metadata, it's included under the metadata.parent field. This allows a single node to respond to all metadata that may be relevant. For instance, this allows metadata to be used to assign a different path to be used when generating pages from a folder's contents.

For instance, for .mdx files, you can query the metadata generated by this plugin with

query YourQuery {
  allMdx {
    edges {
      node {
        parent {
          ... on File {
            fields {
              metadata {
                data {
                  your
                  json
                  keys
                }
              }
            }
          }
        }
      }
    }
  }
}

It's verbose and a little awkward, but it means that the only requirement for using this plugin is using source plugins that generate File nodes. This lets it compose well with other plugin without knowledge of them.

FAQs

Package last updated on 11 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc