Last modified by Vincent Massol on 2024/01/15

Bored with plain text on your pages? Interested in bringing your wiki to life? Then you can use XWiki's powerful programming API right from your wiki pages. XWiki comes with support for several scripting languages: Velocity, Groovy, Python, Ruby, and even PHP.

XWiki exposes APIs that allow you to easily manipulate the wiki and its pages.

To whet your appetite, simply add the following code to your page:

#set($query = "where doc.parent is null or doc.parent='' order by asc")

#foreach($item in $services.query.xwql($query).execute())
#set($orphanedDoc = $xwiki.getDocument($item))
  * [[$orphanedDoc.displayTitle>>$orphanedDoc]] (located in space //$, contains $orphanedDoc.attachmentList.size() attachments)

You'll get a list of orphaned pages (i.e. pages that have no parent). For example:


Check the Developer's Guide and especially the XWiki Scripting section to learn more.

You might also want to check out the Snippets wiki, which contains a lot of code snippets that you can reuse in your pages. And you can also check out the Extensions wiki to install ready-to-use extensions built using these mechanisms.

Get Connected