On Wed, Dec 21, 2016 at 5:37 PM, matmassa <[email protected]> wrote:
As you suggested I created a copy of the navigation panel to work on.
My xwiki pages are structured as follows: https://url/xwiki/bin/view/Projects/FOO/ https://url/xwiki/bin/view/Projects/FOO2/ [...]
Inside "Projects" there are several "main" pages for each project (FOO is an example of the main page of a project). FOO page has a tree structure as you correctly wrote: FOO.A.WebHome FOO.A.B.WebHome FOO.X.Y.Z.WebHome
I thought there were be something similar to manage the new pages logic (an easier way to navigate nested pages). Your suggestion about creating a new document reference using document reference works well, I "played" with substrings:
#set ($index = $openTo.indexOf('xwiki:') +6) #set ($index2 = $openTo.indexOf('.',16)) #set ($subb = $openTo.substring($index,$index2)) #set ($resultpage= $subb.concat('.WebHome'))
Is there a better way to gain this result?
Yes. $services.model.resolveDocument('', 'default', $ doc.documentReference.spaceReferences.get(1)) assuming there are always at least 2 level of space references ("Projects" and the project itself), but you can do some checks to be safe. Hope this helps, Marius
Thank you again, -Matteo
-- View this message in context: http://xwiki.475771.n2.nabble. com/How-to-get-top-level-page-node-in-documentTree-tp7602158p7602176.html Sent from the XWiki- Users mailing list archive at Nabble.com.