You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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".
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.