I have Jekyll blog where some posts have "featured images," some posts don't.
Featured images are defined in the front matter of the post like so: featured-image: http://path/to/img
On the archive page, I'd like to grab the three most recent posts that have featured images and display them.
I imagine this would need an if statement, a counter, and a loop, but I can't get this one 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?