Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Showing with A OR B tags from taxonomy

Started by davidburb 7 years ago · 7 replies · 640 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 complanar, 6 days ago
6 139 15 hours ago
Support · by Rick Beebe, 6 days ago
2 100 2 days ago
Support · by blu3prince, 3 days ago
0 50 3 days ago
Support · by alex, 4 days ago
2 92 3 days ago
Support · by Marcel, 2 weeks ago
1 143 4 days ago