-
Notifications
You must be signed in to change notification settings - Fork 53
Description
CraftQL exposes the Craft content model through GraphQL. To do this we transform every content type/section/entry type in to a unique Object Type within GraphQL. To re-implement this in Gatsby would require re-defining the entire CraftQL schema in to a gatsby-node.js
plugin, essentially duplicating the logic to turn Craft in to GraphQL.
Personally, I was hoping that Gatsby could query CraftQL directly, but that doesn't seem to be the case.
One example: exposes an event entry type, and all the custom fields on an event. You can then find any reverse relationships to the event such as the city the event is in, the hotels related to the event, etc… CraftQL exposes this, like so:
{
entriesConnection(type:event){
edges{
node{
id
title
...on Event{
city
hotels{
name
}
}
}
relatedEntries{
edges{
node{
title
url
type{
name
}
}
}
}
}
}
}
Short of re-implementing the current PHP logic of CraftQL into a Javascript-backed gatsby-node.js
plugin I'm not sure how to expose this level of fidelity through to a Gatsby-backed React component?
Fair warning: I could be way over thinking this or approaching this from the wrong point of view. If so, sorry!