debpu06 / gittalk-blog-comments

Stores comments for development blog via GitTalk
0 stars 0 forks source link

Rendering Gatsby Images from Contentful Rich Text #25

Open debpu06 opened 3 years ago

debpu06 commented 3 years ago

https://davidboland.site/blog/rendering-gatsby-images-from-contentful-rich-text

Gatsby is great at rendering images. To do this, you need to leverage the Gatsby Image Plugin. For most of the images on the site, that is no problem. For images in Rich Text, it's not so simple.

Gitalk_rendering-gatsby-images-from-contentful-rich-text

metrupki commented 3 years ago

Thanks so much! I have been struggling a lot trying to figure out how to use picture in RichText bodies. The Contentful docs weren't much of a help either since the graphql queries described there didn't work. I almost gave up on using RichText, but your advice helped me out a lot and got it working ! Just a tiny thing: the description of the code was a bit confusing, maybe it would be helpful to post another picture with the full code.

debpu06 commented 3 years ago

@metrupki Thanks so much! I have been struggling a lot trying to figure out how to use picture in RichText bodies. The Contentful docs weren't much of a help either since the graphql queries described there didn't work. I almost gave up on using RichText, but your advice helped me out a lot and got it working ! Just a tiny thing: the description of the code was a bit confusing, maybe it would be helpful to post another picture with the full code.

Hey @metrupki, Thanks for the feedback. I will try to think of a way to reword things to make them more clear.

I created this gist of the full code I am using for the Rich Text. I hope that helps clears things up. Either way, I am glad you found the post helpful!