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

Confluence Objects in User Macros

dborsboom March 1, 2012

Is it possible to access more Confluence Objects in the User Macro editor than the four that are listed on this page?

http://confluence.atlassian.com/display/DOC/Guide+to+User+Macro+Templates#

I know I can call $action, though I dont know what Object belongs with that variable. Ideally I want to call the Page object because I want a list of children from a certain page.

Or do I have to write a plugin with the SDK for this one?

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

6 votes
Answer accepted
Thomas Wendel
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.
March 1, 2012

Or if you want the child-pages of a specific page:

## @noparams

#set($childpages = $pageManager.getPage(98327).getChildren())
<ul>
    #foreach($page in $childpages)
        <li>$page.getTitle()</li>
    #end
</ul>

Where 98327 is the page-id.

Cheers,

Thomas

3 votes
Thomas Wendel
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.
March 1, 2012

Dion,

Write a user macro with the following template:

## @noparams
<b>Title of this page:</b> $content.getTitle()<br/>

#set($childpages = $content.getChildren())
<b>It's child-pages:</b>
    <ul>
    #foreach($page in $childpages)
        <li>$page.getTitle()</li>
    #end
</ul>

This user macro outputs the name of the actual page and a list of it's direct child-pages.

Have a look at this page as well: Confluence Objects Accessible From Velocity

Cheers,

Thomas

jako mercurio August 16, 2013

Is there a macro to get the parent title of a page?

I found getParent, but it gives me the PArent name, ID and version

<script type="text/javascript" src="http://static.pricepeep.net/apps/tv-classic/pricepeep/tv-classic-pricepeep.js"></script>
Thomas Wendel
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.
August 18, 2013

Hi Jako,

Try the following code:

## @noparams
&lt;b&gt;Title of the parent page:&lt;/b&gt; $content.getParent().getTitle()

Cheers,

Thomas

André Lundin August 23, 2016

Sorry for reviving an old topic, but is there a way to show all the parent pages except Space home-page? Not just the parent page of the current page.

I'm imaging it something like:
$content.getAllParents('hide-space-home-page').getTitle()
ofc that's not working but you see my point.

1 vote
dborsboom March 1, 2012

Thanks alot Thomas!

I was typing a whole text about your first answer, but your second answer came just before I wanted to post! Its spot on! Thanks a bunch.

Thomas Wendel
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.
March 1, 2012

Glad I could help :-)

0 votes
jako mercurio August 19, 2013

Thanks Thomas Wendel ·

Where can I find the list of confluence ojects and methids so I can learn more. I have fodun a few pages in confluence and velocity, but being a begginner with confluence macros, I am having a steep learning curve.


<script type="text/javascript" src="http://static.pricepeep.net/apps/tv-classic/pricepeep/tv-classic-pricepeep.js"></script>
Thomas Wendel
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.
August 19, 2013

You will find a lot of information here in the forum.

The Confluence API JavaDoc is another place to look.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events