Content by label with external variables or metadata

Patrick Doucet September 18, 2015

Hello,

I would like to know if it's possible to use "Content by label" with a variable like picture below instead the name of the label (label1)

image2015-9-18 14:22:18.png

I tried to modify the macro "Content by label" like this:

## This is an example macro
## @param Name:title=Author|type=string|required=false|desc=Author name
## @param Title:title=Title|type=string|required=true|desc=Title of labelled page
## @param ShowLabel:title=Show label|type=string|required=true|desc=Show label or not (true, false)
## @param Label:title=Label|type=string|required=true|desc=Label name
#set ( $spaceKey = $space.getKey() )
<ac:structured-macro ac:name="contentbylabel">
<ac:parameter ac:name="spaces"/>
<ac:parameter ac:name="author">$paramName</ac:parameter>
<ac:parameter ac:name="title">$paramTitle</ac:parameter>
<ac:parameter ac:name="showLabels">$paramShowLabel</ac:parameter>
<ac:parameter ac:name="reverse">true</ac:parameter>
<ac:parameter ac:name="sort">creation</ac:parameter>
<ac:parameter ac:name="max">10</ac:parameter>
<ac:parameter ac:name="excerpt">true</ac:parameter>
<ac:parameter ac:name="labels">$paramVar1</ac:parameter>
<ac:parameter ac:name="showSpace">false</ac:parameter>
<ac:parameter ac:name="type">page</ac:parameter>
<ac:parameter ac:name="operator">AND</ac:parameter>
</ac:structured-macro>

But I can't to read the content of the page. 

I tried this : $content.MyVariable instead $paramVar1...

Any ideas?

Thank you!

 

1 answer

0 votes
RVal
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 18, 2015

I'm not sure how you going to provide your variable label when opening the page.

But if you have Bob Swift Run plugin installed it is possible to wrap Content By Label inside Run plugin. Then you can add label value as a field input in Run plugin which is then passed to Content By Label as a variable.

<ac:structured-macro ac:name="run">
<ac:parameter ac:name="replace">label:label1:Specify Label</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p><ac:structured-macro ac:name="contentbylabel">
<ac:parameter ac:name="labels">$label</ac:parameter>
</ac:structured-macro></p>
</ac:rich-text-body>
</ac:structured-macro>

 

Patrick Doucet September 18, 2015

I don't have this plugin... It's not possible to read content of the page? If yes, I will read the content of the page and I will call macro "ContentByLabel" after... Something like this : $content.myvar instead $label...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events