问题
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?
回答1:
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).
来源:https://stackoverflow.com/questions/48868328/including-an-image-in-a-jekyll-post-with-custom-size-attribute