Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby-transformer-yaml] Support for multiple data layouts #2257

Closed
r1b opened this issue Sep 28, 2017 · 6 comments
Closed

[gatsby-transformer-yaml] Support for multiple data layouts #2257

r1b opened this issue Sep 28, 2017 · 6 comments

Comments

@r1b
Copy link
Contributor

r1b commented Sep 28, 2017

I have been struggling to integrate gatsby with netlify-cms when using gatsby-transformer-yaml. Currently netlify-cms does not support collections defined in a single file [1]. I created a custom yaml plugin [2] to reconcile the two projects. Now I am curious if there is a path towards integrating this custom transformer with gatsby-transformer-yaml to support a variety of data layouts.

[1] decaporg/decap-cms#531
[2] https://github.com/computer-lab/gatsby-transformer-yaml-netlify

@r1b r1b changed the title [gatsby-yaml-transformer] Support for multiple data layouts [gatsby-transformer-yaml] Support for multiple data layouts Sep 28, 2017
@KyleAMathews
Copy link
Contributor

So what does your transformer do differently? Looks at a quick glance to be quite similar.

@r1b
Copy link
Contributor Author

r1b commented Sep 28, 2017

gatsby-transformer-yaml mandates a data layout where collections are stored as lists at the top-level of a yaml file. Each entry in the list becomes a node with the type determined by the name of the file.

gatsby-transformer-yaml-netlify mandates a data layout where collections are stored as multiple yaml files in a subfolder. The top level of each yaml file is an object. Each yaml file becomes a node with the type determined by the name of the subfolder it resides in.

@KyleAMathews
Copy link
Contributor

Hmmm yeah it could make sense then yeah that if the top-level of the YAML file is an object, make it into a node with the directory name as the type and then if it's an array, make it into a node with the filename as the type.

Yeah, that seems like a really good pattern. You want to make a PR for this? Also to the JSON transformer since they work the same way?

@r1b
Copy link
Contributor Author

r1b commented Sep 28, 2017

For sure - I should have some time later tonight to start working on it.

@swim
Copy link
Contributor

swim commented Sep 29, 2017

Having the JSON transformer behave in this manner as well would be very nice =)

@r1b
Copy link
Contributor Author

r1b commented Oct 8, 2017

Closed by #2324

@r1b r1b closed this as completed Oct 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants