grav
grav copied to clipboard
[FeatureRequest] Twig: Filter a Collection by notOfType
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')wheremodular/linksis the template to exclude
How about a PR? Seems you have a need, have a solution, just create a PR for this feature, and it could get merged.