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.
Has anyone created this user macro in the meantime?
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.