Is it possible to use variables/constants in Confluence?

I'm sure this has been covered before, but I haven't been able to find an answer in my searches thus far...

We are using Confluence to maintain documentation for a software project. This documentation contains certain bits of information in many places - for example, the current version of the software might exist on 10 different pages. Certain filenames or install paths might exist on several pages, several times per page.

To be concise, what I am looking for is to be able to put, in a parent page (or even just another page in the space), something like this:

Then, in my install document, something like this:
"This doc pertains to version ${version} of the software"

And then have that render as:
"This doc pertains to version of the software"

That way, I could take a bunch of common string values, maintain them in one central location and have every relevant page automatically reflect changes.

I took a look at the Metadata Macro, but it seemed to me that it was more tooled to be able to just print out a table of data about a page, rather than easily substituting text as depicted above. Is there another macro I can look at to solve this problem?

Thanks in advance!

3 answers

1 accepted

You could create a page in the space with the version number. Then in other pages, when you need to mention the version number you use the Excerpt Include Macro to include that page which will print the version number (or whatever you wrote in that page).

If you release a new version you can "clone" the space and by changing the page with your version number, it will automatically change in all pages which contained the Excerpt Include Macro.

I looked into this, and it actually works pretty well. The one downside is that only one excerpt is allowed per page.. What I could do is create a number of pages (a la "inclusions library" that each have an excerpt to use throughout the documentation.

That's feasible, but I'm just concerned that it seems a bit messy/overkill for the need.

Has there been any new options to being able to pull 'variables' into a page.

I am willing to create a list of variables page.  And then just enter some sort of link that will display the text of those variables.

Some things like Employee Name, Application Name, Version # etc

Once I get the concept I can use it for others (I hope)

And just as most people asking for solutions, I have no ability to make any plugin additions, especially if there is a fee.

Hi Douglas,

We've implented the exact set-up you've described using the Scaffolding and Reporting plugins from Customware. They're commercial plugins, but reasonably priced. Scaffolding gives you a range of input fields to choose from. text-data or set-data would be good choices for setting variables. Each field is uniquely named so you can have as many as you need. To reference these values you'll then use report-info from Reporting in the other pages. These plugins are really powerful and have been the key to tuning Confluence to meet our needs in many scenarios.



Thanks for the tip. I will try to look into it. Unfortunately, I am not in a position to make any changes like installing plugins (much less paying for them).

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

1,210 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