Children Page Tree

Last modified by Vincent Massol on 2026/06/02 17:54

page_whiteLists all children documents of the currently browsed document
TypeSnippet
Category
Developed by

xwiki:XWiki.FriedemannLoew

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Information

A new Document Tree Macro, and a generic Tree Macro have been introduced in XWiki 6.3.

If the current document is WebHome, the pages of the whole space are printed.

Information

You'll need to install the new version of the DocumentTree Plugin before being able to use this code snippet.

Code (in XWiki Syntax 1.0)

#if($doc.name=="WebHome")
  #set($tree = $xwiki.doctree.getSpaceDocumentTree($doc.web))
#else
  #set($tree = $xwiki.doctree.getDocumentTree($doc))
#end
#set($depths=["", "*", "**", "***", "****", "*****", "******", "*******", "********"])

#foreach($leaf in $tree)
  #if($leaf.depth <= 8 && ($leaf.depth != 0 || $doc.name=="WebHome"))
    $depths.get($leaf.depth) [$xwiki.getDocument($leaf.fullName).getDisplayTitle()>$leaf.fullName]
  #end
#end

Result

  • ChildPage1
    • ChildPage2
    • ChildPage3
      • ChildPage4
    • ChildPage5
      • ChildPage6
      • ChildPage7
  • ChildPage8

Get Connected