How to automatically expand / show all child pages in the sidebar in Confluence?
Asked by Gabriella:

How to automatically show all child pages in the sidebar in Confluence? I want all my confluence users to be able to see everything in the sidebar directly, expanded by default, without having to manually expand by clicking.

Correct:

image2015-8-7 9:55:52.png

Wrong:

image2015-8-7 9:55:13.png

[](https://community.atlassian.com/t5/Confluence-questions/How-to-automatically-expand-show-all-child-pages-in-the-sidebar/qaq-p/333429?attachment-id=10890){#link_1191d68f466d72}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/56341/1/image2017-1-6%2015%3A50%3A7.png){#display_1191d68f466d72_0}  
[](https://community.atlassian.com/t5/Confluence-questions/How-to-automatically-expand-show-all-child-pages-in-the-sidebar/qaq-p/333429?attachment-id=10891){#link_1191d68f466d72_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/56341/2/image2015-8-7%209%3A55%3A33.png){#display_1191d68f466d72_2}  
[](https://community.atlassian.com/t5/Confluence-questions/How-to-automatically-expand-show-all-child-pages-in-the-sidebar/qaq-p/333429?attachment-id=10892){#link_1191d68f466d72_1}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/56341/3/image2015-8-7%209%3A55%3A52.png){#display_1191d68f466d72_4}  
[](https://community.atlassian.com/t5/Confluence-questions/How-to-automatically-expand-show-all-child-pages-in-the-sidebar/qaq-p/333429?attachment-id=10893){#link_1191d68f466d72_2}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/56341/4/image2015-8-7%209%3A55%3A13.png){#display_1191d68f466d72_6}


Answers:
author: Stephen Deutsch
body: Hi Gabriella,

It looks like you're using the documentation theme. In that case, it is possible to expand the pages in the sidebar to a predefined level.

What you will need to do is go to "Browse" and then "Space Admin".

Then, under the "Look and Feel" section, click on "Themes".

Finally, click on "Configure Theme".

Then you can unclick the option "Page Tree" and instead include the pagetree macro in the navigation box. For more info, look at this page: <https://confluence.atlassian.com/display/DOC/Page+Tree+Macro>

More than likely you will want something like this:

```
{pagetree:startDepth=3}or{pagetree:root=@none|startDepth=3}or{pagetree:expandCollapseAll=true}
```

The first one will show all pages underneath the home page and the 2nd one will show all pages in the space, even orphaned pages, expanded 3 levels (you could just set the number to something high like 50 and I think all pages would be expanded automatically). The third option will not expand pages by default, but will include a button above the page tree that would allow you to expand all pages.

You'll just have to play around a bit and find the option that works for you. You should be aware, though, that the Documentation theme has been deprecated and is planned to be removed in the next version of Confluence (and it doesn't work in Cloud anymore at all).

comments: author: Dev Team
body: How to do it in cloud version? This should be so simple.


author: blarsonrp
body: I am also unable to do this in the cloud version given your example.image2017-1-6 15:50:7.png


author: Glenn Dixon
body: In my Server version, this option is now separate - under Look and Feel, there is a separate item for the Sidebar, header and footer. Just paste that code into the sidebar section (or where-ever)


author: philas
body: Works fine. Thank you.

How to excerpt single pages from expanding?


author: Nicolas Casel
body: Thanks [@Stephen Deutsch](/t5/user/viewprofilepage/user-id/781490) for indicating this macro (to be setup in 'Space tools / Look and feel / sidebar'):

```
{pagetree:expandCollapseAll=true}
```

However, in my case, using it is pointless because a custom Theme overrides default build (and behaviour) of the Confluence left pagetree. So I am wondering if it is possible to know the Javascript code which is behind this 'page tree expand' macro. Then, I will try to apply this code in a way or another, to force and get expanded items.

To sum up, what is the code triggered by clicking 'Expand all:'

![expand.collapse.wikis.png](https://community.atlassian.com/t5/image/serverpage/image-id/138831iA7ADE3C63234021D/image-size/large?v=v2&px=999 "expand.collapse.wikis.png")

?


author: Dee Elling
body: Is it still not possible to configure this in the cloud version? It is October of 2019.

comments: author: Jason Choe
body: +1


author: Michael Ross
body: There's a header and footer section, but I can't see a sidebar option in v10


author: Adrien Ragot 2
body: Hi Gabriella, I think they didn't do it for performance purpose: Every child page must be checked against permissions. Not that it's impossible to improve this performance (cache, etc), but no-one has done it yet.