Orphaned Pages
Last modified by Ecaterina Moraru (Valica) on 2021/03/18 11:28
![]() | Lists pages that do not have a parent |
Type | Snippet |
Category | |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
Orphaned pages are pages that have no parent set.
Code
Syntax 1.0
#set ($query = "where (doc.parent is null or doc.parent='') and doc.fullName != 'Main.WebHome' order by doc.name asc")
{table}
Page Name | Author | date
#foreach ($item in $xwiki.searchDocuments($query))
#if ($xwiki.hasAccessLevel('view', $xcontext.user, "${xcontext.database}:${item}"))
#set ($bentrydoc = $xwiki.getDocument($item))
[${bentrydoc.fullName}] | $xwiki.getUserName($bentrydoc.author) | $xwiki.formatDate($bentrydoc.date)
#end
#end
{table}
{table}
Page Name | Author | date
#foreach ($item in $xwiki.searchDocuments($query))
#if ($xwiki.hasAccessLevel('view', $xcontext.user, "${xcontext.database}:${item}"))
#set ($bentrydoc = $xwiki.getDocument($item))
[${bentrydoc.fullName}] | $xwiki.getUserName($bentrydoc.author) | $xwiki.formatDate($bentrydoc.date)
#end
#end
{table}
Syntax 2.0
{{velocity filter="none"}}
{{html clean="false" wiki="true"}}
#set ($query = "where (doc.parent is null or doc.parent='') and doc.fullName != 'Main.WebHome' order by doc.name asc")
|=Page Name|=Author|=date
|#foreach ($item in $xwiki.searchDocuments($query))
#if ($xwiki.hasAccessLevel('view', $xcontext.user, "${xcontext.database}:${item}"))
#set ($bentrydoc = $xwiki.getDocument($item))
[[${bentrydoc.fullName}]]|$xwiki.getUserName($bentrydoc.author)|$xwiki.formatDate($bentrydoc.date)
|#end
#end
{{/html}}
{{/velocity}}
{{html clean="false" wiki="true"}}
#set ($query = "where (doc.parent is null or doc.parent='') and doc.fullName != 'Main.WebHome' order by doc.name asc")
|=Page Name|=Author|=date
|#foreach ($item in $xwiki.searchDocuments($query))
#if ($xwiki.hasAccessLevel('view', $xcontext.user, "${xcontext.database}:${item}"))
#set ($bentrydoc = $xwiki.getDocument($item))
[[${bentrydoc.fullName}]]|$xwiki.getUserName($bentrydoc.author)|$xwiki.formatDate($bentrydoc.date)
|#end
#end
{{/html}}
{{/velocity}}
Result
Here is an example of the snippet on a XWiki 2.6 wiki page: