Filtering collection by category

Hi!

I’m having some trouble filtering a collection of pages by category. This seems very simple and close to issues solved previously on the forum, but I can’t seem to be able to solve this.

I’m building a website for a small film fest. I have a page ‘movies’ that ideally would display children of page ‘programme’, filtered to display only pages of category ‘movie’. (The ‘programme’ page collection also has concerts and other events).

I guess this would start this way:

title: Films
content:
    items: 
    - '@page.children': '/programme'
    filter:

But what should I have in ‘filter’?

I’m afraid I spent the afternoon on this. Any help is much appreciated!

If I understand correctly what you want to achieve, try this

title: Films
content:
    items:
      '@page.children': '/programme'
movie:
    items:
       '@taxonomy.category': movie

and add to the page template

{# collection #}
{% set collection = page.collection %}
{% set movie_collection = page.collection('movie') %}
{% set collection = collection.intersect(movie_collection) %}
2 Likes

Many thanks Vadym! That does it.