Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagelist: display only future events #86

Closed
Pentaonia opened this issue Jan 2, 2024 · 2 comments
Closed

Pagelist: display only future events #86

Pentaonia opened this issue Jan 2, 2024 · 2 comments

Comments

@Pentaonia
Copy link

Pentaonia commented Jan 2, 2024

Hi,
I'm using the pagelist widget. Everything is working fine, thank you for your great work(!), but I have a question:

image

What do I have to do to show only pages with a date in the future?

Best
Loubert

@marcantondahmen
Copy link
Owner

Hi there, the default pagelist block template doesn't support filtering by date. However, you can write a new template for the pagelist block or modify the one you are using in order to add a conditional that compares the page date with the current datetime. The current datetime can be accessed using the @{ :now } runtime variable. The conditional would look as follows:

<@ if @{date} >= @{:now} @>
    @{title}
<@ end @>

You can find more info in the docs about how to use templates for blocks.

@Pentaonia
Copy link
Author

Hey Marc,

works perfectly! Just copied a template in /packages/standard/templates/blocks/pagelist and wrapped all after the foreach in your conditional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants