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.

Support

Showing with A OR B tags from taxonomy

Started by davidburb 7 years ago · 7 replies · 495 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

Thank you. Could you give me any pointers on how to use this method? It seems like it is what I am looking for but I can't quite figure out how to use it. Is it called in the Frontmatter or does it need to be part of the Twig code in the main page?

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 Thomas, 1 week ago
2 53 9 hours ago
Support · by Anna, 3 days ago
2 59 12 hours ago
Support · by Justin Young, 13 hours ago
1 30 13 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 56 5 days ago