gatsby-uc / gatsby-source-strapi

Gatsby source plugin for building websites using Strapi as a data source
MIT License
355 stars 183 forks source link

Help with media in component #315

Closed jasewarner closed 2 years ago

jasewarner commented 2 years ago

Hi there,

Looking for some help, as I haven't been able to get any further with fetching an image from a component. I'm using gatsby-source-strapi v2.0.0 in combination with @strapi/strapi v4.1.5.

My "SEO" component has two text fields and an image one. In GraphQL, whilst I can see the Title and Description fields, I do not see anything for the Image field.

Can somebody point me in the right direction?

Thanks

remidej commented 2 years ago

Hello Jase

It looks like your content structure is several levels deep: Content type > seo component > image

So you have a relationship in a relationship. You'll need to set the your content type's population accordingly. Here are a couple links that can help you:

Please let me know if that fixes your issue

jasewarner commented 2 years ago

Ok, sorted it out – thanks for your prompt.

I hadn't realised that images needed an additional level, nor did I spot that the fields are case-sensitive in gatsby-config.js.