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:
"$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

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

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.

Regards,

Charles

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

346 views 20 10
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