It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Children Display Macro

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

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

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.

Hello,

Are you familiar with user macros/do you have access to create them? I found an existing (credit to @Steven 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
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

7,071 views 6 6
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you