Page collection for future events

Hi all,
Another question :slight_smile: (I’m almost done with this project and now I’m tackling the last things I had a hard time with along the way). I have a page where I show events. All the pages in the collection have a start and end date. Now I would like to only display the events that are in the future. I saw that I can add dateRange to the frontmatter. Does this filter on the publication date of the page? And is there a way I can use dateRange to apply to my custom start and end date? Or is there another way to configure my page collection so that it only shows future events? Thanks a lot in advance!

The date: option in frontmatter is the only date that describes when a page is to be published. If you put a future date, the page is not ‘published’ until that date is past. This allows you to create posts/content and it will auto-publish in the future.

If you want to get all the pages in the future you will need to create your own collection and filter by date.

Thanks for your clear reply! I now replaced my custom date input event_end by the default date and added the following frontmatter to my event index page:

    items: '@self.children'
        start: today
        end: 1/1/2100

A weird thing happens now though; it only shows the event that is happening today, while it should display all events that are happening from today until January 1st 2100. What is going wrong?

I think it is due to the fact that dateRange is checking only for the publication date. Maybe someone can provide a solution, but I think you could achieve it with Twig with something like this:

{% endfor %}

I didn’t test it, so there might be some syntax error

@paul thanks for your reply! Along the way I found out that my yaml data was not rendered correctly. Threw out my event pages and started from scratch. Now the dateRange did work :slight_smile: