Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Confluence 4.0: How can I use the title of a page inside a macro called within a user macro?

Daniel Werner February 5, 2012

How can I use the title of a page inside a macro called within a user macro in confluence 4?

I.e. the following inside a user macro doesn't work:

<ac:macro ac:name="info">$content.getTitle()</ac:macro>

It returns an empty info box.

1 answer

1 accepted

1 vote
Answer accepted
Andrew Frayling
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.
February 29, 2012

Hi Daniel,

Try:

<ac:macro ac:name="info">
  <ac:parameter ac:name="title">Foo</ac:parameter>
  <ac:rich-text-body>$content.getTitle()</ac:rich-text-body>
</ac:macro>

I.e. put $content.getTitle() inside a <ac:rich-text-body> element. Just did a quick test on my 4.x install and it seems to work.

Andrew.

Tyler K. April 16, 2012

This won't get the full title if the title contains characters between < and > symbols for instance the title

I am <not> tall

with be displayed

I am tall

Do you know if there is a fix for this?

Using 4.1

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events