When listing content entries in a page, you might want to filter entries or create a pagination system. Here's how to do that.

We consider that you have created an event content type

as described [here](🔗).

## Add a category field to the event content type

In your **app/content_types/events.yml**, add a block:



Edit **data/events.yml** and add a field category for each entry.



## Filter the entries on "foo" category

You will use ``with_scope` liquid tag to filter the entries.

In a page, type:



## Listing another content type inside the with_scope tag

More often that not, you will probably want to relate your filtered content type to another related content type.

Building up on the previous exemple, let's say that you have defined the events content type and the speakers content type and that each event has many speakers. Check [here](🔗) for more details on how to create such a relationship between two content types.



Previous versions of Locomotive

Please note that for the code proposed in this section to work, you need to have a version of steam above version with commit [dfa638b38d7579ab0193341e20a4ef3345846e51](🔗) installed.

## Reverse the entries

Add the reversed option to the for tag:



## Pagination

You can easily create a navigation with page number, and previous or next button.



You also can use the paginate filter instead of the pagination div:



Learn more:

  • [with_scope tag documentation](🔗)

  • [paginate tag documentation](🔗)

with_scope and pagination

When using both with_scope and pagination the pagination must be included within the with_scope tag, not the other way around.