1. Home
  2. Liquid
  3. Limit for loop

You can use limit attribute to restrict the numbers of returned results by the for loop.

#liquid#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
Full Liquid cheatsheet