Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Page collection operators

Started by Michael 6 years ago · 0 replies · 750 views
6 years ago

Hi. I'm creating a template in which I want to surface posts with more than one taxonomy category using page collections. The problem is at the moment it is resulting in pages that match the total combination of tags rather than a tag from that list. (I'm looking to use 'or' and by default page.collection uses 'and')

TLDR;

I want a way of creating a page collection like this:
{% for page in page.collection({'items':{'@taxonomy':{'food_drink_category':'food_drink_tag', 'dish_category':'dish_tag'}},'order': {'by': 'random', 'dir': 'desc'},'limit': 10, 'filter':{'visible': 'true'}}) %}

In the same way I can use 'or' here:
{% for page in taxonomy.findTaxonomy({'food_drink_category':'food_drink_tag', 'dish_category':'dish_tag'},'or') %}

Not a developer, just someone who has been experimenting with Grav for the last year or so. Thanks.

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by MarkP, 2 days ago
2 70 1 day ago
Themes & Styling · by TomW, 2 days ago
0 34 2 days ago
Themes & Styling · by themetman, 1 week ago
1 136 6 days ago
Themes & Styling · by AH, 3 weeks ago
1 251 1 week ago
Themes & Styling · by Bruno, 4 years ago
6 1428 1 week ago