mikefowler / gatsby-plugin-collections

Create pages, with support for pagination and customizable permalinks, from a folder of Markdown files.
MIT License
11 stars 3 forks source link

Plugin doesn't play nice with gatsby-remark-images or frontmatter File type fields. #6

Open cristiantx opened 5 years ago

cristiantx commented 5 years ago

When trying to use the plugin with image file types I get this error.

error Field "featuredImage" of type "File" must have a selection of subfields. Did you mean "featuredImage { ... }"?

I digged a little in the code and it's because getAvailableFrontmatterFields returns all the frontmatter fields which includes the ones set as File, which requires more parameters.

Solution would be to just ignore or query them the right way. I don't know if that's even possible I'm not very experienced in GraphQL.

cristiantx commented 5 years ago

Looking more into the code I'm not sure why it needs all the fields there. It doesn't seems to be used anywhere going down in the createPages file.