Exclude a page by label in an include content by label macro

If I have a bunch of pages about say fruit. They all have a label of 'fruit' and then a second label of the type of fruit it's about. Example 'apple' or 'orange' or 'strawberry'.

If I then used the Include content by label macro to include all pages with a label of 'fruit' but I wanted to exclude any apple pages how would I do that?

In the "Include content by label macro" labels form I have tried......

fruit,-apple or fruit -apple

+fruit,-apple or +fruit -apple

and have tired all of those with the operator of 'or' or 'and' and can't get it to work. What am I missing?

2 answers

This widget could not be displayed.

The filtering by labels in content reports uses the inclusive OR.  This means that if your filter says Label A, Label B then Confluence will return all pages with "Label A OR Label B OR Both":

AorB.png

(An exclusive OR, which Confluence does NOT use, would return pages with "Label A OR Label B but NOT pages with Both").

To perform an AND - i.e. to return only pages with "Label A AND Label B" - you need to add a new filter line:

AandB.png

That will return those pages that have both "Label A AND Label B", in other words it won't return pages unless they have both of those labels.

 

In your specific case, you need "fruit AND NOT apple", so on the 1st line have "fruit" and on the 2nd line have "-apple".  This will give you "fruit AND NOT apple".

 

This widget could not be displayed.

That makes great sense but I don't have an option to add a second label field filter. 

ConfluenceQuestion1.png

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Tuesday in Confluence

Add-on evaluation with confluence templates

Atlassian market place contains number of Apps/Addons which improves the capability of out of the box Atlassian products. It is good to follow a plugin evaluation process before install add-ons. So t...

121 views 12 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you