Closed sureshvv closed 12 years ago
jinja2 is powerful enough to do this using good ol' python slicing, but I hadn't tried it until now! v4.5.10 - just pushed - supports slices.
{% for news in site.news[0:3] %}
...
{% endfor %}
Awesome!
In looking at the other issue you're having, #29, I realized that site.news[0:3]
will give the three oldest news items.
site.news[-3:]
is what we want here, I think.
I can see how I would pick all of them. But how do I pick just the top 3?