Going Stellar

Home/Confluence storage format reference

Confluence storage format

children and pagetree macros in Confluence storage format

The children macro lists the child pages of a page and the pagetree macro draws the page hierarchy as an expandable tree. Both are body-less ac:structured-macro elements whose parameters are plain ac:parameter children. The Cloud documentation names them child items and content tree.

Storage format

<ac:structured-macro ac:name="children"></ac:structured-macro>
<ac:structured-macro ac:name="children"><ac:parameter ac:name="all">true</ac:parameter><ac:parameter ac:name="depth">2</ac:parameter><ac:parameter ac:name="sort">title</ac:parameter></ac:structured-macro>
<ac:structured-macro ac:name="pagetree"></ac:structured-macro>
<ac:structured-macro ac:name="pagetree"><ac:parameter ac:name="root">@self</ac:parameter><ac:parameter ac:name="startDepth">2</ac:parameter></ac:structured-macro>

In the editor

HowNote
Type /childitems and select Child items, or use the + toolbar buttonPer the Atlassian documentation.
Type / and keep typing the name of the content tree macro, or use the + toolbar buttonPer the Atlassian documentation.

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

<ac:structured-macro ac:name="children"><ac:parameter ac:name="all">true</ac:parameter><ac:parameter ac:name="depth">2</ac:parameter><ac:parameter ac:name="sort">title</ac:parameter></ac:structured-macro>
{
 "type": "doc",
 "content": [
  {
   "type": "extension",
   "attrs": {
    "extensionType": "com.atlassian.confluence.macro.core",
    "extensionKey": "children",
    "parameters": {
     "macroParams": {
      "all": {
       "value": "true"
      },
      "depth": {
       "value": "2"
      },
      "_parentId": {
       "value": "<page id>"
      },
      "sort": {
       "value": "title"
      }
     },
     "macroMetadata": {
      "macroId": {
       "value": "<id>"
      },
      "schemaVersion": {
       "value": "2"
      },
      "title": "Child pages"
     }
    }
   }
  }
 ],
 "version": 1
}

Examples

Storage format sent

<ac:structured-macro ac:name="children"></ac:structured-macro>

Lists the direct children of the page that holds it, with no configuration at all. Useful as a navigation block on a parent page.

Rendered view (HTML)

Storage format after the round trip through ADF

<ac:structured-macro ac:name="children" ac:schema-version="2" ac:macro-id="<id>" />

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="children"><ac:parameter ac:name="all">true</ac:parameter><ac:parameter ac:name="depth">2</ac:parameter><ac:parameter ac:name="sort">title</ac:parameter></ac:structured-macro>

Lists every level below the page (all), limited to two levels (depth) and ordered alphabetically (sort). Solves the case where a hub page must show a whole subtree in a fixed order.

Rendered view (HTML)

Storage format after the round trip through ADF

<ac:structured-macro ac:name="children" ac:schema-version="2" ac:macro-id="<id>"><ac:parameter ac:name="all">true</ac:parameter><ac:parameter ac:name="depth">2</ac:parameter><ac:parameter ac:name="sort">title</ac:parameter></ac:structured-macro>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="pagetree"></ac:structured-macro>

Draws the page tree for the space with no parameters. The rendered view is a plugin_pagetree container with a hidden treeId field that the browser fills in.

Rendered view (HTML)




<div class="plugin_pagetree conf-macro output-inline" data-hasbody="false" data-macro-id="<id>" data-macro-name="pagetree">

                        
                
        <ul class="plugin_pagetree_children_list plugin_pagetree_children_list_noleftspace">
            <div class="plugin_pagetree_children">
            </div>
        </ul>

        <fieldset class="hidden">
            <input type="hidden" name="treeId" value="" />
            <input type="hidden" name="treeRequestId" value="/wiki/plugins/pagetree/naturalchildren.action?decorator=none&amp;excerpt=false&amp;sort=position&amp;reverse=false&amp;disableLinks=false&amp;expandCurrent=false" />
            <input type="hidden" name="treePageId" value="<page id>" />

            <input type="hidden" name="noRoot" value="false" />
            <input type="hidden" name="rootPageId" value="655541" />

            <input type="hidden" name="rootPage" value="" />
            <input type="hidden" name="startDepth" value="0" />
            <input type="hidden" name="spaceKey" value="SD" />

            <input type="hidden" name="i18n-pagetree.loading" value="Loading..." />
            <input type="hidden" name="i18n-pagetree.error.permission" value="Unable to load page tree. It seems that you do not have permission to view the root page." />
            <input type="hidden" name="i18n-pagetree.eeror.general" value="There was a problem retrieving the page tree. Please check the server log file for more information." />
            <input type="hidden" name="loginUrl" value="/wiki/login.action?os_destination=%2Frest%2Fapi%2Fcontent%2F<page id>%3Fexpand%3Dbody.storage%2Cbody.view%2Cbody.atlas_doc_format%2Cversion" />
            <input type="hidden" name="mobile" value="false" />

                        <fieldset class="hidden">
                                                            <input type="hidden" name="ancestorId" value="655541" />
                                                </fieldset>
        </fieldset>
    </div>

Storage format after the round trip through ADF

<p><ac:structured-macro ac:name="pagetree" ac:schema-version="1" ac:macro-id="<id>" /></p>

Sent to Confluence Cloud on .

What changes in conversion

  • children keeps all three parameters through storage to ADF and back. The ADF is an extension node (extensionKey children) with every parameter under macroParams as a {value} object, plus a generated _parentId parameter and a schemaVersion of 2.
  • pagetree comes back wrapped in a paragraph after the ADF round trip, because ADF stores it as an inlineExtension. children stays a top-level element because ADF stores it as a block extension.
  • Neither macro changed its parameters on the round trip. None of the pagetree parameters named in the documentation (root, sort, excerpt, reverse, searchBox, expandCollapseAll, startDepth) was probed, so their survival is not confirmed.

Pitfalls

  • The view is generated for the page it renders on. The same stored macro gives a different list on a page with other children, so body.view cannot be used to check what the macro was configured to do.
  • The probes only exercised all, depth and sort on children. The documentation page for child items describes options in the editor but does not list their storage names, so any other parameter name has to be confirmed against a real page.
  • The ADF form of both macros carries a _parentId parameter that holds the id of the page it was saved on. ADF copied from one page to another carries that id with it.

Questions and answers

Which macro name do I write for the Cloud 'child items' macro?

Storage uses ac:name="children". A macro with that name saved and rendered as expected, and its parameters all, depth and sort were kept.

Can the tree start at the current page?

The documentation lists '@self' as a value of the root parameter for pagetree. No probe sent it, so the stored result is not confirmed.

Sources

  1. What are macros? (Atlassian Support, Confluence Cloud)
  2. Insert the child items macro (Atlassian Support)
  3. Insert the content tree macro (Atlassian Support)

Markdown version · All storage format pages