How can set the page properties report macro in a template to refer to current page programatically?

Andy Phillippe June 25, 2015

I want to create a template that includes a page properties report macro to show a list of child pages, limited to only show the current page's children.

I have upgraded to 5.8 so can take advantage of the "with Parent" field, but I can't see a way to set it in the template so that field is automatically set to the new page created by the template.

I guess I'm looking for @self or something similar so that I don't have to set that macro every time I create a page from the template.

7 answers

2 votes
Peter_Baschan November 22, 2018

Hi. There is an option in the parameters of the page properties report macro to do this.

Select 'Add a filter'

Select 'With ancestor'

And select Current page.

 

Now the report only brings up the child pages.

 

Page Properties macro.PNG

K Nadrowska December 11, 2019

It worked for me. Thank you.

0 votes
Robert Reiner _smartics_
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 4, 2016

I do not know how to to it with the Page Properties Report Macro, but you could use other add-ons to limit the result set to children.

For instance the (commercial) projectdoc Toolbox Add-on has the Display Table Macro which supports the parameter Restrict to immediate Children. Note that you need to use the Document Properties Marker Macro instead of the Page Properties Macro provided by Confluence.

The code for the macro in storage format looks like this:

<ac:structured-macro
  ac:name="projectdoc-display-table">
    <ac:parameter ac:name="doctype">asset</ac:parameter>
    <ac:parameter ac:name="render-no-hits-as-blank">true</ac:parameter>
    <ac:parameter ac:name="render-mode">definition</ac:parameter>
    <ac:parameter ac:name="select">Name, Short Description, Rating</ac:parameter>
    <ac:parameter ac:name="restrict-to-immediate-children">true</ac:parameter>
    <ac:parameter ac:name="sort-by">Sort Key, Name</ac:parameter>
</ac:structured-macro>

Biased Alert: I'm one of the authors of this add-on. smile

0 votes
Deleted user May 4, 2016

Did anyone find a solution for this? Trying to do the same.

0 votes
Martin Sokolowski July 15, 2015

Looking for this feature as well! Wonder how it could be missed ...

0 votes
David Allemann July 8, 2015

I also expected this update to page properties report macro to allow you to be able to limit reporting to the current page's children.

0 votes
Richard George July 6, 2015

I'm also looking for this feature - seems it's missing currently.

0 votes
Andy Phillippe June 25, 2015

I have looked at the page in the Source editor. After creation, the macro looks like this: <ac:structured-macro ac:macro-id="70bb97d7-6709-41ea-a6a4-e86ad0830c77" ac:name="detailssummary" ac:schema-version="2"> <ac:parameter ac:name="label">requirements</ac:parameter> <ac:parameter ac:name="cql">label = "requirements" and space = currentSpace() and parent = "2359318"</ac:parameter> </ac:structured-macro> The space filter is using a method currentSpace(). I have tried applying that logic to parent, using parent = currentPage() but that method doesn't exist. So is there an equivalent method for the current page?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events