Children Display Macro

clevjam March 18, 2020

Is there a way to automatically number the items in the 'Children Display Macro'?

It would be really nice to know how many child pages there are.

It would also be really nice to be able to use multi-level number, so one could very quickly and easily reference a specific page, such as:

 

1. Child page 1

2. Child page 2

2.1 xxx

2.1.1 yyy

3. Child page 3 

1 answer

0 votes
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 18, 2020

Hello,

Have you taken a look at the Pagetree Macro? This is an example of the macro being run on my page.

Screen Shot 2020-03-18 at 9.21.42 AM.png

clevjam March 18, 2020

That's a pretty nice macro, but it doesn't seem to provide the auto-numbering feature that I'm looking for.

My main goal with the auto-numbering is to clearly get a quick count and in turn a high-level scope of the work.

For example:

If I can quickly see that there are 12 child pages and I know that each one will take 5 minutes to update (or fix or create or ...), then I will know that it is going to take approximately an hour to do the work.

Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 18, 2020

Hello,

Are you familiar with user macros/do you have access to create them? I found an existing (credit to @Steven F Behnke one online and modified it slightly to get a first pass at what you are looking for. It will look one level deep, and provide a count for all the child pages.

If you need it to look deeper, that could be done, but I'd have to spend some more time on it.

 

Screen Shot 2020-03-18 at 10.59.26 AM.png

 

To create this, go to Administration > User Macros > Create new use rmacro.

 

For the options, I put in the following:

Screen Shot 2020-03-18 at 11.05.44 AM.png

The code itself looks like this:

## Macro title: Children and Parent
## Macro has a body: N
## Body processing: No macro body
##
## Developed by: Steve Behnke, modified by Kian Stack
## Date created: 3/18/2020
## Installed by: Your name here...
##
## This macro creates a unordered list of the current page and descendants.
##
## @noparams
#set($currentPage = $pageManager.getPage($content.getId()))
#set($childPages = $currentPage.getChildren())
<ul>
<li>
<a href="$currentPage.getUrlPath()">$currentPage.getDisplayTitle()</a>
</li>
<ol>
#foreach ($childPage in $childPages)
<li>
<a href="$childPage.getUrlPath()">$childPage.getDisplayTitle()</a>
</li>
#end
</ol>
</ul>

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events