Liquid Templating 'latest_articles' Collection with limit N

Posted by seon on Friday, July 11

Recently I modified my home template to render only the latest X articles.

I changed this:
1
{% include 'article' with articles %}
... into this:
1
2
{{ site | latest_articles: 5 | assign_to: 'recent_articles' }}
{% include 'article' with recent_articles %}

I am not really satisfied with this markup. Is there a more concise solution that does not involve local variable assignment?

Comments

Leave a response

Comment