Parses YAML files. Supports a data layout that is compatible with netlify-cms.
This behavior was added to gatsby.
If you cannot upgrade you can still use this plugin by installing it via npm or
cloning it into a plugins/
folder as described in the docs.
You must be using a version of node that supports object rest/spread (e.g v8.6.0).
npm install --save gatsby-transformer-yaml-netlify@alpha
// In your gatsby-config.js
plugins: [
`gatsby-transformer-yaml-netlify`,
]
If you have a data layout like so:
data/
takers/
a-taker.yml // value: a
b-taker.yml // value: b
leavers/
a-leaver.yml // value: a
b-leaver.yml // value: b
Then four nodes will be created:
[
{
value: 'a',
type: 'TakersYaml'
},
{
value: 'b',
type: 'TakersYaml'
},
{
value: 'a',
type: 'LeaversYaml'
},
{
value: 'b',
type: 'LeaversYaml'
}
]
You'd be able to query your takers like:
{
allTakersYaml {
edges {
node {
value
}
}
}
}
And your leavers like:
{
allLeaversYaml {
edges {
node {
value
}
}
}
}