Can I use variables across multiple Confluence pages?
Asked by Scott Eade:

I have a bunch of pages in a space that include references to things like client names. I want to be able to clone this space and have a means of updating the client name (amongst several other parameters) to some new value so that I can then commence working on documentation tailored to a specific client.

I can imagine a couple of ways of achieving this and this leaves my quite surprised that there is not a built-in feature or an obviously available plugin that will do what I want.

* I could export a space and run a bunch of search/replace operations.
* Nicer would be a configuration page for a space where I could set as many variables as I like and have these used when rendering page content within the space. These could be interpreted statically, i.e. when a page template is used, or dynamically, i.e. resolved at the time the page is rendered so that I can change them.

Is there a feature or plugin I am failing to see that can achieve this?


Answers:
author: Robert Reiner _smartics_
body: Our (commercial) [projectdoc Toolbox Add-on](https://www.smartics.eu/confluence/display/PDAC1/) allows to define properties for a space. These [space properties](https://www.smartics.eu/confluence/display/PDAC1/Space+Properties) are accessible by the [Display Space Property Macro](https://www.smartics.eu/confluence/display/PDAC1/Display+Space+Property+Macro) that is also part of the add-on.

So if you define a [space blueprint](https://developer.atlassian.com/confdev/confluence-plugin-guide/confluence-blueprints/space-blueprints) or create a new page with references to space properties using the *Display Space Property Macro*, the values for these properties will be resolved on request time on this page.

For instance, if you define a space property (with the [Document Properties Marker Macro](https://www.smartics.eu/confluence/display/PDAC1/Document+Properties+Marker+Macro) on the space home page) named "Customer" with a value of "Example Inc." then the *Display Space Property Macro*, referencing the "Customer" property, will render the value "Example Inc.". When you change the name for the customer, the macro will always render the current value.

For more information on dealing with space properties, please refer to **[Using Space Properties](https://www.smartics.eu/confluence/display/PDAC1/Using+Space+Properties)** on our web site (**which I'd recommend as an introduction to this topic** :smile:).

comments: author: Scott Eade
body: The projectdoc Toolbox plugin does a whole bunch of things, one of which is that it allows space and page level properties to be defined and used subsequently in other documents. This is precisely what I am after.

Having run a trial of this plugin it looks like it meets my needs and in fact I have now purchased it. As part of my solution I am also making use of the Copt Page Tree and Copy Space plugins.

I asked a few questions of the developers and quickly received a comprehensive response that included details of how to apply the tool in a couple of corner cases, so I am certainly pleased with their support and impressed by comprehensive capabilities of the plugin.


author: James Tome
body: For those looking for solutions on Confluence Cloud. All the above entries are specific to Data Center. I have yet to find a solution for CF Cloud, but will reply here if I find something.


author: Nic Brough -Adaptavist-
body: It's not as nice as variables, but you could do this with user macros - you can easily write one that could say client:address, and have a long list of clients in a "case" type statement. Or, as I did for one place, have it based on the current space instead of a parameter (so you'd just say "client" and the macro would work it out from the space or other data somewhere)  

The downside is that you'd need admin rights to edit the content, so it's not brilliantly flexible


author: EPS Software Engineering AG
body: Hi Scott,

With our add-on Space Tree Creator you can achieve the functionality you are looking for. The add-on does a search\&replace during the creation process. The variables (tags) are marked by special characters (__) within normal Confluence pages. You don't need any programming skills.

**Check out our live examples: [link](https://focuspro.eps.ch/display/PEPSMarktExample/Marketplace+Examples)**

Marketplace Link: **[Space Tree Creator](https://marketplace.atlassian.com/plugins/eps.focuspro.SpaceTreeCreator/server/overview)**

Regards,  
Stephan

comments: author: Scott Eade
body: Thanks for your reply Stephan. Your plugin would appear to provide a nice way of applying variables at the time a tree of pages is created. This is an excellent solution, but in my case I am after the ability to modify the values even after the pages have been created.


author: Adrian Reid
body: The closest thing to this is the Excerpt or Multi-Excerpt plugin which reuses content on one page across pages.

But yes, a variable plugin would be great. How about it plugin developers?

comments: author: EPS Software Engineering AG
body: Hi Adrian,

Christmas is quiet away, but here it is ;-)

The [Easy Space Variables](https://marketplace.atlassian.com/plugins/eps.focuspro.variables/server/overview) Add-on. Try it out and let us know, if it fits your needs.

Regards,  
Stephan