# 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

Latest version **0.0.0** (published 2019-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install gatsby-plugin-folder-metadata
pnpm add gatsby-plugin-folder-metadata
yarn add gatsby-plugin-folder-metadata
bun add gatsby-plugin-folder-metadata
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2019-10-11 |
| First published | 2019-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Carl Vitullo |
| Maintainers | vcarl |

## Links

- npm: https://www.npmjs.com/package/gatsby-plugin-folder-metadata
- npm.io page: https://npm.io/package/gatsby-plugin-folder-metadata

## Recent versions

- 0.0.0 (latest) — 2019-10-11

## README

# 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

```graphql
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.

---
_Source: https://npm.io/package/gatsby-plugin-folder-metadata · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
