Is it possible to use variables/constants in Confluence?

Douglas Rapp October 30, 2012

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:
"$version=1.2.3.4"

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

3 votes
Answer accepted
Alejandro Conde Carrillo
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.
October 30, 2012

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.

Douglas Rapp October 30, 2012

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" https://confluence.atlassian.com/display/DOC/_InclusionsLibrary) 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.

2 votes
Casey Maynard July 31, 2017

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.

0 votes
CharlesH
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.
October 31, 2012

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.

Regards,

Charles

Douglas Rapp October 31, 2012

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
TAGS
AUG Leaders

Atlassian Community Events