Including an image in a Jekyll post with custom size attribute

眉间皱痕 提交于 2020-02-03 16:45:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!