jpedroschmitz / rocketdocs

Easy to use Gatsby Theme to create documentation websites ⚡️🔥
https://rocketdocs-gatsby.vercel.app/
MIT License
254 stars 95 forks source link

Please make the project exposes multiple YAML files to GraphQL nodes. #120

Closed aaronamm closed 2 years ago

aaronamm commented 2 years ago

What would you like to be added:

Parameterize typeName of gatsby-transformer-yaml plugin or make it flexible that we can expose new YAML to new GraphQL node.

Why is this needed:

Since we set typeName to static value SidebarItems, we cannot expose new YAML file to a new GraphQL node.

Is your enhancement request related to a problem? Please describe.

I would like to add new data stored in YAML and expose it as GraphQL node that I can query later. However, adding gatsby-transformer-yaml plugin section in my custom gatsby-config doesn't help. This is because it cannot override the existing typeName: 'SidebarItems' and all new YML files will be merged to this type. This also causes an issue when trying to [query allSidebarItems in gast-by-node.js].(https://github.com/jpedroschmitz/rocketdocs/blob/main/%40rocketseat/gatsby-theme-docs-core/gatsby-node.js#L75)

Additional context

This screenshot took from my personal project that I added multiple YAML files and exposed them to GraphQL nodes. I only use default type name of gatsby-transformer-yaml

image

jpedroschmitz commented 2 years ago

Could you open a PR for it?

We can add a new option for this.

aaronamm commented 2 years ago

@jpedroschmitz Thanks for your reply. I will create a PR to add a new option for @rocketseat/gatsby-theme-docs.

aaronamm commented 2 years ago

@jpedroschmitz PR's opened #124 Thanks.