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 →

Showing with A OR B tags from taxonomy

Started by davidburb 7 years ago · 7 replies · 860 views
7 years ago

Hi there,

Just a simple one here. In my frontmatter, I would like to create a collection using that pulls in anything tagged with "oranges" OR "apples". When defined as below, it only brings in things tagged with BOTH "oranges" AND "apples". Is there a simple way to define the collection such that any post tagged with either of the tags is in the collection?

YAML
title: 'Oranges & Apples'
content:
    items:
        '@taxonomy.tag':
            - oranges
            - apples
    order:
        by: date
        dir: desc
    limit: 5
    pagination: true
7 years ago

I'm afraid this doesn't help me. It lists pages tagged only with foo AND bar. Not foo OR bar (or both)

7 years ago

Oh, I can't believe I had overlooked that! Thanks for your help.

7 years ago

And an update in case if anybody else wants to do the same thing - I tried this as @Perlkonig said and it worked perfectly. Thanks for the help!

Suggested topics

Topic Participants Replies Views Activity
Support · by TomW, 2 weeks ago
8 227 9 hours ago
Support · by alex, 2 months ago
8 667 23 hours ago
Support · by Supple, 5 days ago
1 98 1 day ago
Support · by TomW, 1 week ago
3 159 3 days ago
Support · by TomW, 6 days ago
2 106 5 days ago