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

[FeatureRequest] Twig: Filter a Collection by notOfType #3910

Open
kittyfishfrommars opened this issue Mar 5, 2025 · 0 comments
Open

[FeatureRequest] Twig: Filter a Collection by notOfType #3910

kittyfishfrommars opened this issue Mar 5, 2025 · 0 comments

Comments

@kittyfishfrommars
Copy link

kittyfishfrommars commented Mar 5, 2025

Currently Grav supports filtering a Page Collection by including specific templates types via Collection::ofType.

I would also like to exclude specific template types from a Page Collection, so I can display the results differently.

This could be achieved via Collection::notOfType.
Preferably this new function accepts an Array or List for to remove multiple templates at once.

Acceptance Criteria

  • In Twig It is possible to exclude a single/multiple template types from a Page Collection

Solution

  • page.collection()|filter(module => module.template != 'modular/links') where modular/links is the template to exclude
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

1 participant