Confluence: how to use variables in a page

John Bercik
Contributor
January 11, 2012

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 ?

7 answers

2 votes
Shilpa Devi August 2, 2017

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

Shilpa Devi August 2, 2017

@K Cann

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

1 vote
Armin Schenkel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 7, 2020

Mediawiki is way better than Confluence... How bad is this implemented in Confluence?

https://de.wikipedia.org/wiki/Hilfe:Variablen

Just see the example of Wikipedia, where the pagename can be easily added as variable into a link, or text or whatever.

Confluence seems to lack the basic simplicity and syntax of every wiki system ever made.

0 votes
Andres Alzate
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 1, 2020

Hi,

 

Is the option of Variables not available anymore?

Cheers

0 votes
K Cann July 10, 2017

See reply.

pd
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 6, 2018
0 votes
Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 12, 2012

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:

($generalUtil.getUserAccessor().getUser($userId))

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

K Cann July 10, 2017

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?

 

Konstantin Gevorgyan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 25, 2018

Were you able to find answer on this?

Warren Goldman
Contributor
May 25, 2018

I have not, and K Cann's explanation is accurate

EPS Software Engineering AG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2018

Maybe our Easy Space Variables App could solve the problem. You find it on the Marketplace.

Regards,
Stephan (CEO of EPS Software Engineering AG, vendor of the Easy Space Variables App)

0 votes
John Bercik
Contributor
January 11, 2012

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

Warren Goldman
Contributor
April 13, 2018

how do you create a "User Macro"?

Like Krzysztof Królikowski likes this
0 votes
David at David Simpson Apps
Atlassian Partner
January 11, 2012

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events