List Orphaned Pages Using a Velocity Script
Last modified by superadmin on 2026/11/25 21:39
Content
A wiki page that lists every page with no parent, generated by a short Velocity script.
Steps
- Make sure your administrator gives you programming rights.
- Edit the page using the Wiki editor.
- Add the following Velocity script, which lists the pages with no parent, to the page content:
{{velocity}} #set($query = "where doc.parent is null or doc.parent='' order by doc.name asc") #foreach($item in $services.query.xwql($query).execute()) #set($orphanedDoc = $xwiki.getDocument($item)) * [[$orphanedDoc.displayTitle>>$orphanedDoc]] (located in //$orphanedDoc.space//, contains $orphanedDoc.attachmentList.size() attachments) #end {{/velocity}} - Save the page.
- Notice how the page now renders a bulleted list of orphaned documents, each showing its space and attachment count:
