Can a Space defined variable overwrite excerpt-include variable from template space

Erick van Rijk
Contributor
June 3, 2019

Hello everybody,

I'm currently working on getting our technical documentation in Confluence server and a large portion of the documentation is boilerplate text that will be the same over multiple projects.

The current idea I have (originating from here) is to use excerpt-include or include page to include multiple template pages (from a template Space (TS)) to build up a project page.

One thing that is not working correctly is that I would like to have a project/space defined variable (defined in _ConfluenceInclusions) that is present in this template text and will be automatically updated using the space variable.

Example:

Template page (device_page) in Template Space (TS):

This is a test page and refers to the device: _device_name

Project page in Project Space (PS):

This information is about a brand new device:

{excerpt-include:TS:device_page|nopanel=true}

The idea would be to replace the _device_name with a local space variable so the boilerplate code can be the same for every instance of this template but still match the local device reference.

I did find the Keysight Include Content plugin but its kind of difficult to use for non technical users.

While browsing the documentation and community I did not find exactly what I am looking for.

Any ideas / suggestions?

Thanks!

1 answer

0 votes
Erick van Rijk
Contributor
July 3, 2019

Still haven't found an exact solution to this.

projectdoc Toolbox Seems to have some items that might work. But the hurdle seems to be that I want to use per scope variables inside template files.

https://community.atlassian.com/t5/Confluence-questions/How-can-I-use-variables-to-define-Space-properties-such-as/qaq-p/619160

Q: @Robert Reiner _smartics_ Could you advise?

Robert Reiner _smartics_
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.
July 3, 2019

There are a few solutions to the problem to transclude content from another page with the projectdoc Toolbox.

Straight forward would be to create a section (using the Section Macro) and add text with placeholders, e.g. in a dedicated template space:

"This is the text of ${Product Name} that ..."

Note the placeholder with name "Product Name".

From a projectdoc Document (may also be a plain Confluence page) within another space (e.g. the Super Tool space) you could use the Transclusion Macro and replace the placeholders with properties provided as space properties (see Using Space Properties for how to define space properties) and document property by checking the parameter "Apply Document Properties". If unchecked, only key/value pairs in the body of the macro will be applied.

Assuming that there is a space property "Product Name" with the value "Super Tool" the transcluded text will be rendered as 

"This is the text of Super Tool that ..."

There is a tip on our website Using Placeholders that provides information for this use case.

As an alternative you could use the Impersonator Feature. There is also a tip on our website Impersonator - using Live Templates that explains it. The impersonation allows to render the transcluded content in the context of the transcluded page. For simple text replacements this makes no difference (as long as the context of the transcluded page does not already provide values for the placeholders). But in case -- for instance -- you need to list components of a product, the list would be rendered in the context of the product page.

If I misunderstood your use case or if you have problems to run your use case with my explanation, please get in touch! :)

Erick van Rijk
Contributor
July 5, 2019

Hi @Robert Reiner _smartics_ ,

thank you for you extensive answer. I will give the plugin a try in the upcoming weeks.

I will let you know if I have any issues.

Robert Reiner _smartics_
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.
July 5, 2019

Hi @Erick van Rijk,

Thank you for your feedback! 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events