Articles Anywhere

How to filter by multiple tags (article must include all)

1 year 6 months ago #81396

Gerd's Avatar Gerd

Couldn't find a hint in the documentation....

I want to filter by multiple tags. But, different than the comma separated list (which basically is an OR) I want only articles that are tagged with ALL of the specified tags.

Example

Article-1 --> tags: a,b,c
Article-2 --> tags: a,c

{articles tags="a,b" } will give me both articles but I only want article-1 as it contains both a and b.

Right now I am using tags="a,!c" but that's not very maintainable as more tags get added to an article.

1 year 6 months ago #81397

Andy Badwool's Avatar Andy Badwool Moderator

Hello,

Unfortunately that is not possible right now. All multiple filters work as a OR.

We will think on whether to implement this feature.

1 year 6 months ago #81399

Gerd's Avatar Gerd

Yeah - that would be a useful feature to add IMO. Thanks for considering.

Just a suggestion 🙂 Maybe syntax-wise this could look like this:

{articles tags="a" tags="b" }

that way it's consistent when mixing it with other filter criteria.

Also, on a different yet related note, I noticed that an article with no tags triggers/matches to all articles when using a dynamic parameter such as 'current'.

Hope my feedback is useful. overall AA is a great add-on.

1 year 6 months ago #81632

Peter van Westen's Avatar Peter van Westen Admin

Multiple attributes with the same name is not possible in Articles Anywhere.
Using the '!' on a value is only possible at the start and will affect all values for the attribute.
So tags="!a,b,c" will mean: not a, not b, not c.

Changing this behaviour and allowing multiple same-type filters is not something that will be considered for implementing, as this would pretty much mean a rewrite of Articles Anywhere.

What you can do to additionally exclude stuff is use the {if} tags, like:

{articles tags="a"}{if tag="b"}...{/if}{/articles}
This will look up all the articles that have tag "a". Then what is inside the {if} will only be output for articles that have tag "b".

1 year 6 months ago #81634

Gerd's Avatar Gerd

Thanks Peter - will play around using the {IF} clause. And good to know about the '!' being applied to all values in a comma-separated list. I wasn't aware of that.

2 months 19 hours ago #89888

Andy Badwool's Avatar Andy Badwool Moderator

Hey @Gerd, just wanted to let you know that this feature is now finally available.

You can now show articles that contain two or more tags at the same time, by separating the tags with a + instead of a comma.

This will show articles that have BOTH the Fluffy AND the Cuddly tag:

{articles tags="Fluffy+Cuddly"}...{/articles}

Read the Blog Post for more details:
www.regularlabs.com/blog/1369-articles-a...provements-and-fixes