Confluence: how to use variables in a page

How can I use variables in a page in Confluence please? For example I want to type "company" variable and have it insert my company name, address, city, state.

Can I have a list of variables for a space that all pages in the space can use ?

5 answers

I dont see this question answered yet. I have a similar requirement to meet and would be glad if any one in the Community can provide a feasible solution

@K Cann

Did you get this question answered. I am not able to view your reply.

0 vote
David Simpson Community Champion Jan 11, 2012

Tell us which product you want help with -- Confluence?

I did get a "User Macro" setup to include text with the reference to the user macro "{mymacro}". Is that the only way ?

0 vote

I'm not quite understanding what you mean by a variable. Do you mean that you would type 'company' and the values would change, depending on who you are (ie what company you work for?).

In either case, writing either a user macro or a plugin would probably be the way to go. If it's simply a text replacement, it looks like you already discovered the user macro. If it's a true variable, and pulls some data from LDAP, you can probably even do that in a user macro as well (you can access the user object, then try to get user properties), like this:


There's a good example here. Let us know more specifically what you want.

I think that the question can be explained as follows (this is also my question):

  1. The content author for a page enters a variable, such as <company>.
  2. Somewhere else, the author defines a list of values for each variable. One of these might be, for example, company = Atlassian.
  3. On the page, Confluence replaces the variable <company> with the value 'Atlassian'.
  4. Any exported output also replaces the variable <company> with the value 'Atlassian'.
  5. If the content author changes the value to something else, the value is automatically replaced on the Confluence page.

How might this be accomplished?


Suggest an answer

Log in or Join to answer
Community showcase
Kesha Thillainayagam
Posted Mar 05, 2018 in Confluence

We want to know what templates you're using in Confluence!

Hi Community!  My name is Kesha (kay-sha not Ke$ha) and I'm on the Confluence Product Marketing team. We are trying to understand and improve template use cases in Confluence, and are intereste...

2,275 views 20 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot