How can I get the space-key into my space blueprint template?

Ozan Güder
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 30, 2018

Hi,

i am writing a space blueprint with the help of the "Write a simple Confluence Space blueprint" tutorial. I now need to write a template which contains the tasks-report-macro but i have a problem with getting the space-key as a parameter inside the macro.

Using <at:var at:name="key"/> doesn't work. When i look at the storage format of the created template the spaces-parameter looks like this: <ac:parameter ac:name="spaces" />

My (not working) code looks like this:

<ac:structured-macro ac:name="tasks-report-macro">
<ac:parameter ac:name="spaces"><at:var at:name="key"/></ac:parameter>
<ac:parameter ac:name="pageSize">10</ac:parameter>
<ac:parameter ac:name="labels">product-requirements</ac:parameter>
</ac:structured-macro>

 

Thanks for you help! :)

4 answers

0 votes
Mirtul
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 3, 2023

for anyone still looking for an answer to this (I know I did):

the space-key variable is named "spaceKey", not "key"

 

<at:var at:name="spaceKey"/>
0 votes
Simon Neuville July 10, 2020

I am also looking for an answer to this question!

 

Would be great if this was solved and documented somewhere. Unfortunately, the documentation for space blueprints is really lacking...

0 votes
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.
September 2, 2018

I can only offer a hack as a workaround:

Add the XML element to the blueprint context and render it.

The following code snippet is from an implementation based on the com.atlassian.confluence.plugins.createcontent.api.contextproviders.AbstractBlueprintContextProvider. The context points to an object of type com.atlassian.confluence.plugins.createcontent.api.contextproviders.BlueprintContext. The spaceKey is simply the string with the key.

 context.put("spaceKeyElement",
"<ri:space ri:space-key=\"" + spaceKey + "\" />");

 The add this to the XML blueprint:

<ac:parameter ac:name="spaceKey"><at:var at:name="spaceKeyElement" at:rawxhtml="true"/></ac:parameter>
0 votes
Micle dortel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 30, 2018

I have the same question. Did you find something ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events