I'm trying to automatically set parts of the title in pages created with a macro, inspiation found here: https://community.atlassian.com/t5/Confluence-questions/How-to-count-the-number-of-child-pages-with-a-particular-label/qaq-p/445878
The macro I've written counts the child pages of the current parent, and returns that number + 1, indicating the numeric title of the page to be created
1 Parent (this page has a "create from template" button)
1.1 Child one
1.2 Child two
1.3 Child three, etc.The parent page has a "Create from template" button. When trying to use the `countChildren` macro when generating the `Child one` pages and so on from a Template, the returned number of children is zero. I suspect the macro doesn't recognize `1 Parent` as a parent page anymore.
How do I refer to the `parent` page which calls the template in a macro?
## @noparams
#set($pageCount=0)
#foreach ($child in $content.children)
#set($pageCount = $pageCount + 1)
#end
$pageCount