Adding Images to Gatsby Blog in MarkdownPosted on 2019-08-26
Ok I spent the past 3 hours trying to find out this annoying little thing. Spoiler alert: You DON'T NEED any Gatsby plugins. Stop reading these lies. (JK, some plugins allows you to enjoy Gatsby's image optimization feature, but unfortunately the documentation is too bad - I tried everything but nothing worked for me. Hence this original hack-y solution.)
All you need:
- Create a folder in your "public" folder. Call it "images". Put your image files into this folder.
- Refer to your image in your markdown file by typing this:
- You need to commit your public folder. Run
git add -f /public/imagesbecause usually your public folder is in git ignore