Getting links from a content in Velocity


in XWiki 4.5.3 I use to use this piece of code to retrieve the links include inside a page:

#set($pageDoc = $xwiki.getDocument($page))
#foreach($child in $pageDoc.getLinks())

in XWiki 10.6 it doesn’t work. Any suggestion on how to getting them?

Many Tanks

I have XWiki 10.6 and the following code:

#set ($links = $xwiki.getDocument('Sandbox.WebHome').getLinks())
#foreach ($link in $links)
  * $


  • XWiki.XWikiSyntax
  • Sandbox.TestPage1
  • Sandbox.TestPage2
  • Sandbox.TestPage3
  • Main.WebHome

So it does work for me. Maybe there’s something special about your page. Does it use the XWiki 2.0 or 2.1 syntax?

Hi Marius,

First I would like to thank you for your reply.

I try to use it inside a Skin object (the property “pdf.vm” for export a PDF). So, I don’t know which syntax use this environment.


Best Regards

The syntax used inside the Skin object properties is plain Velocity, but that’s not what I asked. I asked what is the syntax of the page you get the links from, Sandbox.WebHome in my example.

xwiki 2.1