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

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

https://confluence.atlassian.com/display/DISC/if-label

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).

Hello,

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

862 views 23 12
Join discussion

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