Gatsby source plugin for Payload CMS - any ideas welcome #2707
Replies: 1 comment 1 reply
-
Hey @thompsonsj — I am not too familiar with Gatsby plugins but I know that @sandren from Candycode is also looking into building a Gatsby plugin for Payload. Did you see that Payload is able to output its entire GraphQL schema to a text file? This could help, but I'm not sure. You also might be able to reuse some of Payload's internal functions like https://github.com/payloadcms/payload/blob/master/src/graphql/schema/buildObjectType.ts Let's keep this conversation going. I think it'd be great to have a Gatsby plugin. |
Beta Was this translation helpful? Give feedback.
-
Hello Payload community! I've just started work on a Gatsby source plugin for Payload CMS.
https://github.com/thompsonsj/gatbsy-source-payload-cms
It's currently working for loading basic data. I've taken care to detect fields where Gatsby should not try to infer a schema, such as rich text, block and upload fields. In these cases, I stringify the JSON to keep it queryable and usable to some extent.
Currently working on:
Any feedback/ideas/thoughts are most welcome. For example, Payload CMS (at least by default) does not broadcast field types in API responses. As a result, I am using my own logic to try and determine each field type: https://github.com/thompsonsj/gatbsy-source-payload-cms/blob/main/plugin/src/payload-field-type.ts
I wonder if there is a better way? Have I missed something?
Beta Was this translation helpful? Give feedback.
All reactions