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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,440
Community Members
 
Community Events
184
Community Groups

Excerpt from parent page

hello guys, i need your help :-)
i want to include the content "123" from the parent page. If i use the excerpt macro i have to define the "page with excerpt", how can i define this without knowing the exact name of the parent "master-page"?
I mean, if someone creates a new page below "Master-Page-123" it should automatically reuse the content of the parent "Master-Page-123".

3 answers

@0x7c2 

I created a custom user macro for this:

 

## Developed by: Felix Schäfer & Alexander Wirtz
## Date created: 07/12/202

## @noparams

#set($parentId = $pageManager.getPage($content.id).parent.getContentId().asLong())
#set ($requestedPage = $pageManager.getPage($parentId).getTitle())

#if ($parentId)

<ac:macro ac:name="excerpt-include" ac:schema-version="1">
<ac:parameter ac:name="nopanel">true</ac:parameter>
<ac:default-parameter>$requestedPage</ac:default-parameter>

</ac:macro>

#else
Cannot show tasks on parent page because this page has no parent.
#end

Hey ,

I hope you are still active and can help me here.

I have 2 Confluence servers. On one server this macro works fine and I created many templates which work perfectly. But on the other confluence server I always get "Cannot show tasks on parent page because this page has no parent."  eventhough the settings, the templates and the macro are absolutely identical.

Do you know what could be the problem?

Thank you!

Kirstin Seidel-Gebert
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.
May 11, 2023

Hi I_A May,

you can debug the macro by printing the parameters temporarily to see if something goes wrong within the code like

#set($parentId = $pageManager.getPage($content.id).parent.getContentId().asLong())
<p>$parentId</p>
#set ($requestedPage = $pageManager.getPage($parentId).getTitle())
<p>$requestedPage</p

This gives you the possibility to see if something useful comes from these calls.

Cheers,
Kirstin

Has anyone created this user macro in the meantime?

0 votes
Kirstin Seidel-Gebert
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.
Jan 06, 2020

Hi 0x7c2,

In Confluence you can write our own user macros (see Writing User Macros). You can wrap the excerpt macro with your own user macro that gets the name of the master page (parent) and puts it into the excerpt macro.

For how to get the parent of a page using Velocity code you'll have to google around (I've never done this).
I gave it a quick try and came across something like $content.getParent().getTitle(). Did not try it, though.

Cheers,
Kirstin

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events