×

You're using an outdated browser

For a better experience, keep your browser up to date. Check here for the latest version.

Manual

Can I use variables?

Roman Serazhiev

Roman Serazhiev Last update: Jul 2, 2018

Confluence does not officially support variable management (although there is currently an open feature request for this for Scroll Versions). However, it is possible to implement a workaround by using user macros that function as placeholders for a variable's name.

Note

  • You will require global administrator permissions to follow these steps, as they involve creating and managing user macros.
  • Variables managed using this method are NOT version-aware – their names will remain the same regardless of the version of the page where they are included.
  • Variables created using this method will be available in all spaces, as the macros used to make them are defined globally.

Creating a variable

Firstly, you need to create a user macro which will function as a placeholder for the variable's name.

The macro should have no body (select No macro body on the Macro Body Processing menu), and should contain the following code:

## @noparams
Variablename

where 'Variablename' is the name of the variable.

Using the variable macro

Now, whenever you want to write the name of your variable, insert the macro onto the page:

... and it will appear as though you typed the variable's name out manually:

Changing a variable's name

If the name of your variable changes, you can update the content of the macro by editing the placeholder text (in our example 'Variablename') to reflect the changes.

Info

These changes will be applied in all spaces, as the macro is defined globally.

If we go to the macro editor and change the macro content text to 'Newvariablename':

then everywhere that you have used the macro, the text 'Variablename' will automatically be replaced with 'Newvariablename'.

2x3.13
We use cookies to create a secure and effective browsing experience for our website visitors and to understand how you use our site (i.e. Google Analytics). For more information: click here.
Ok