I have a Jekyll blog where some posts have "great images", some posts don't work.
Selected images are defined in the front of the message, for example: featured-image: http://path/to/img
On the archive page, I would like to capture the last three posts in which there are images and their display.
I assume that for this you need an if statement, a counter and a loop, but I cannot get this to work for me:
<ul id="archive-featured"> {% assign count = '0' %} {% if count < '4' %} {% for post in site.posts %} {% if post.featured-image == true %} {{ count | plus: '1' }} <li><a href="{{ post.url }}"><img src="{{post.featured-image}}" />{{ post.title }}</a></li> {% endif %} {% endfor %} {% endif %} </ul>
What am I missing?
source share