How to build an contextual navigation in the sidebar?

We have multiple sections in our xwiki. The overall structure is like this:

  1. Section1
    1.1) Sub-chapter 1.1
    1.1.1) content a
    1.1.2) content b
    1.2) Sub-chapter 1.2
    1.2.n) content n
  2. Section2
    2.n) Sub-chapters of 2.n
    2.n.m) content of subchapters 2.n
  3. Section3
    3.n) Sub-chapters of 3.n
    2.n.m) content of subchapters 3.n

the standard navigation shows the full page tree. What i like to have are 2 navigation elements.

The first element is like the main navigation. It contains only links to the main sections 1, 2 and 3 and is not showing any subpages. This can be done easily with a individual menu by using the menu application.

The second element should always show the full page tree of the actual section you are in. If you click on “section1” in the mainnavigation, the second navigation should always show the page tree under section1. And when you switch to section2, the menu will show the pagetree of section2.

I´ve found a way to display the current subpages. But this only works on the main page of a section. As soon you navigate into the next level, you will only see the childs of the actual page and not on the according section.

I hope i was able to explain what i mean. It is a little bit like the concept of spaces in confluence, where you can have multiple sections with their own navigation tree.
do you have any idea / tipp for me?


I would try to make a panel that uses 3 document tree macros for which you specify the root (the section) and use showRoot=true to show the parent section in the tree.

1 Like

But it don’t looks like a Navigation menu. In this case it is another styles of list