Adding images to the body of a post in Gatsby

I would like to know how I could add images to the body of a Gatsby markdown post? When I added netlify-cms to my site, I seemed to lose that functionality. Please advise. Thanks!

Best regards,

Maria

Hey there! Can you share a bit more about what what you mean by “lose functionality”? Is there an error message you can share? Could you also please share your NetlifyCMS config.yml and Gatsby config? All of that will help us dig in a bit more :slight_smile:

Already figured it out. I have automated deployments set up for my repository, as well as Netlify CMS for Gatsby, and figured out that I had to first upload the image I want to add to a Gatsby post via the CMS itself by clicking on the Media tab and then uploading the image I want to use. Then, when creating a new post in the CMS, I simply add the image in the body widget using markdown syntax and pointing to the img folder I have in my static folder, something like this:

![Image text](/img/image.png)

Then, after the build resulting from my automated deployment originating from a push to my master branch is complete, I git pull the changes on remote, and then push to master. Then I wait for that build to complete. When it is complete, I go and check out the published post on my site, and the image appears there. I wrote up a post on the process on my blog there if you want to check it out: Images in Gatsby Post Content when using Netlify CMS

2 Likes

Fantastic! I’m so glad you were able to figure this out and really appreciate your thorough documentation of how you got it working- will definitely be helpful to others who find this post after running into the same problem :muscle:

I too am trying to get the images to be displayed in my post . The funny thing is the 1st image is getting rendered in the preview but the second pic is not [I doubled checked…its not a spelling error…see second pic]

The images are all uploaded to the Github repo too.