So, the issue i have really boggles me. I have access to a variable from a Contentful field, but i don't for the other 4 that are placed in identical fields as the first one, all in the same content model. This is my query:
export const pageQuery = graphql`
query blogPostQuery($slug: String!) {
contentfulBlog(slug: { eq: $slug }) {
product1Title
product2Title
product3Title
product4Title
product5Title
}
}
`
In terminal it seems i get:
GraphQL Error Unknown field
product2Title
on typeContentfulBlog
If i delete product2Title from the query, i get the error at product3Title and so on. product1 works fine.
What do you see in the GraphiQL inspector at http://localhost:8000/___graphql ? If you open the documentation (link top right), then explore, can you post a screenshot of the contentfulBlog
type and which fields it has?
I can hopefully post a more precise answer if you can share this info, but in the meantime, you might be affected by Gatsby ignoring empty fields.
The article explains in more depth. A short summary, if you have a field which is empty on Contentful, it will not appear in Gatsby. You can make sure you have at least 1 of your records on contentful that has all of your product title fields to solve this.