I want to insert an image in a blog post in a way that is consistent when viewing it locally and after pushing it to GitHub. This means I cannot use absolute path. Also, I do not want to use another online drive to store my pictures. This means I cannot use an url of the image. That leaves me with using relative path.
Solution
- Create a folder called “images” at the root of the local repository.
- Put the image to be inserted there.
- Use the format
![](/blog/images/image-name.png){:width="800px"}
to insert image in the corresponding markdown file. - Follow step 10 or 11 here to view locally or publish to the blog site.