How would I show an include or some controls only if a label is present on that page?

I have some pages, where I denote the type of the page using a label. (e.g. 'marketing')

On each of those labeled / typed pages, I want to show an {include} that brings in extra information .

How would I do this?

We are using Confluence 5.3.1

Thanks, M.

2 answers

1 accepted

0 votes
Answer accepted

You could use the "if-label" user macro, which can be found here:

NOTE: Ignore step 7.

I haven't tested it myself, but it should work.

Thanks Stephen.

Yes, it worked, with a couple of tweaks! I've posted my replacement version to the page you pointed me to.

Glad to hear it worked for you, and thanks for the update! I think a lot of people don't consider how powerful the user macro functionality is, and unfortunately many of the user macros on the shared page don't work so well anymore (not to mention that the full documenation for user macros is pretty sparse).


I would love to have the opportunity to use more than one label within the macro. Currently I give out a status macro named Draft to my page whenever there is a draft-label attached to the site.

It would be great If I could add some more statuses like Approved, Reviewed etc. Unfortunately I'm absolutely in lack of experience in order to rewrite my own version of this macro.

Maybe someone can think of a solution and give me a hint?

Best regards!

Why not just include multiple versions of the same macro in the page? You can choose any label in the options. If the label doesn't exist, they don't take up any space on the final page anyways. Or perhaps I didn't understand your use case.

Hey Stephen,

thanks for your fast reply. Of course that is a possible solution BUT I would prefer having less macros (best just one) on my pages. I have some late adopters in the team I currently work for and they can be easily scared away by having too much stuff they do not understand (yet).

I know this is quite a "first world problem" so I guess I will give your suggestion a try and see how it is going with the team. Thank you!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

402 views 2 13
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