limit for loop
You can use limit attribute to restrict the numbers of returned results by the for loop.
<ul>
{% for page in site.pages limit:5 %}
<li>
<a title="{{ page.title }}" href="{{ page.url }}">{{ page.title }} </a>
</li>
{% endfor %}
</ul>
copy