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

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

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

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?

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

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.

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

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

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:

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

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Dec 10, 2018 in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

193 views 5 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you