cogLists pages that do not have a parent
TypeSnippet
Category
Developed by

Vincent Massol

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Orphaned pages are pages that have no parent set.

XWiki 1.1 M1 and above include both an 'Orphaned pages' page and a Panel

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}

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}}

Result

Here is an example of the snippet on a XWiki 2.6 wiki page:

listAllOrphanedPages.png

Tags:
     

Get Connected