Jsevillamol
Jsevillamol

Reputation: 2563

Including an image in a Jekyll post with custom size attribute

In a Jekyll post I want to include an image I have in the address images/posters/surfaces.png.

Furthermore, I want it to have a 750px width.

I tried <img src={images/posters/surfaces.png} alt="Poster" style="width: 750px;"/> and <img src="images/posters/surfaces.png" alt="Poster" style="width: 750px;"/> but it did not work.

What syntax should I use instead?

Upvotes: 4

Views: 925

Answers (1)

marcanuy
marcanuy

Reputation: 23982

Relative links lead to confusion, better use absolute URLs like:

 {{ "images/posters/surfaces.png" | absolute_url }}

Or if you won't use Jekyll in a subdirectory, just use /images/posters/surfaces.png (note the leading slash).

Upvotes: 1

Related Questions