3.9 KiB
| layout | title | description | tags | |||
|---|---|---|---|---|---|---|
| post | A Post with Images | Examples and code for displaying images in posts. |
|
Here are some examples of what a post with images might look like. If you want to display two or three images next to each other responsively use figure with the appropriate class. Each instance of figure is auto-numbered and displayed in the caption.
Figures (for images or video)
One Up
Two Up
Apply the half class like so to display two images side by side that share the same caption.
{% highlight html %}
And you'll get something that looks like this:
Three Up
Apply the third class like so to display three images side by side that share the same caption.
{% highlight html %}
And you'll get something that looks like this:
Alternative way
Another way to achieve the same result is to include gallery Liquid template. In this case you
don't have to write any HTML tags – just copy a small block of code, adjust the parameters (see below)
and fill the block with any number of links to images. You can mix relative and external links.
Here is the block you might want to use:
{% highlight jinja %} {% raw %} {% capture images %} /images/abstract-10.jpg /images/abstract-11.jpg http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png {% endcapture %} {% include gallery images=images caption="Test images" cols=3 %} {% endraw %} {% endhighlight %}
Parameters:
caption: Sets the caption under the gallery (seefigcaptionHTML tag above);cols: Sets the number of columns of the gallery. Available values: [1..3].
It will look something like this:
{% capture images %} /images/abstract-10.jpg /images/abstract-11.jpg http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png {% endcapture %} {% include gallery images=images caption="Test images" cols=3 %}