Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Page collection operators

Started by Michael 6 years ago · 0 replies · 515 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 Pedro M, 2 months ago
4 198 2 months ago
Themes & Styling · by Ian, 2 months ago
3 94 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 456 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 48 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 128 3 months ago