Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Range posts in Jekyll

Tags:

jekyll

liquid

In order to show only 4 posts I'm using the following snippet:

{% for post in site.categories.mycategory limit:4 %}
  {{ post.content }}
{% endfor %}

Now, in a second container, I need to show posts from 5 to 8, then posts from 9 to 12 and so on. Is there a filter to range posts? Thanks.

like image 314
isar Avatar asked Oct 26 '25 10:10

isar


1 Answers

You can use offset to skip the first elements:

{% for post in site.categories.mycategory limit:4 offset:4 %}
  {{ post.content }}
{% endfor %}

Also consider pagination.

like image 50
rgmt Avatar answered Oct 29 '25 09:10

rgmt