'Jekyll how to display an image in a post
I am trying to follow the Jekyll docs and am stuck on how to display an image
---
layout: post
title: "My first post!"
date: 2016-10-20 16:17:57 +0200
categories: jekyll update
regenerate: true
---
This is in the `_posts` directory.
It can be edited then rebuild the site to see the changes.
You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
![name of the image][{{site.url}}/assets/P6740674.JPG]
I feel very silly asking this question as it is so basic but I can not find any answers to my question
Is it possibly a configuration error on my own system. I am using apache2, ruby gems, etc
Thanks in advance
Solution 1:[1]
If you want to use site.url
, you have to add a url
variable to your _config.yml
file. More info in the Jekyll documentation.
But you might not have to use site.url
at all. Any urls that start with a /
slash will be relative to the top level of your domain. So you could do this:

Solution 2:[2]
I could see an images
directory created under assets
by default. I've placed an image as follows.
assets/images/myimage.jpg
and add following line in the post.

Run bundle exec jekyll serve
and see if there is any error. If you have mentioned mismatching file location, you will see error here.
Solution 3:[3]
The problem here is annoying simple - you have the wrong format for your image link.
It should be 
. You have ![name][link]
. Note the difference in the brackets. Everything else is fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Anto |
Solution 3 | Andy Clifton |