How can I always show the left sidebar on some pages when using the Documentation theme?
Asked by Armon Tiongco:

I need some of the pages to always show the left navigation in the documentation theme.

I am thinking of something somewhat opposite to that hiding it. So far, once you hid it on one space, it seems to remember that - so when users navigate from there - the left navigation is still hidden.

We want the left navigation to always remain. Is there a way to completely show this on the page.

Thanks,


Answers:
author: Davin Studer
body: I asnwered a similar question here and it could be adapted to fit your needs.

[https://answers.atlassian.com/questions/212656/how-do-i-show-hide-sidebar-in-the-documentation-theme-depending-on-a-url-parameter](/questions/212656/how-do-i-show-hide-sidebar-in-the-documentation-theme-depending-on-a-url-parameter)

comments: author: Davin Studer
body: You could put this into an HTML macro in the page.

```
&lt;script type="text/javascript"&gt;AJS.toInit(function () {	var splitPos = AJS.$('#splitter .vsplitbar').css('left')	if(splitPos === '0px') {		AJS.$('#splitter-button').click();	}});&lt;/script&gt;
```


author: Armon Tiongco
body: Hi David,

Can you please explain further how this code helps?

```
&lt;script type="text/javascript"&gt;AJS.toInit(function () {    var show = getParameterByName('show_sidebar');    var splitPos = AJS.$('#splitter .vsplitbar').css('left')    if((show === '1' &amp;&amp; splitPos === '0px') || (show === '0' &amp;&amp; splitPos != '0px')) {        AJS.$('#splitter-button').click();    }}); function getParameterByName(name) {    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");    var regex = new RegExp("[\\?&amp;]" + name + "=([^&amp;#]*)"),    results = regex.exec(location.search);    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));}&lt;/script&gt;
```

I already added it but it doesnt seem to work. When i navigate from a hidden left navigation page to another space - the left navigation is still hidden,


author: Armon Tiongco
body: it works! Thank you so much! :)


author: Davin Studer
body: Check out my code above. I adapted it from the link I sent in the answer. In the original link I sent the user was looking to control the nav based on a parameter passed in the url. The code above is adapted from that. If you put it into a page then it will always be open when you go to that page. You could even adapt this further to be a user macro (less easy to mess up and easier to add on multiple pages). He is an example. This would allow you to just put a macro called opennav on any page you want the nav open on.

**Macro Name:**   
opennav  

**Macro Ttle:**   
Open Nav

**Description:**   
Open the nav on page access.

**Macro Body Processing:**   
No macro body

**Template:**   
## Macro title: Open Nav  
## Macro has a body: N  
## Developed by: Davin Studer  
## Date created: 09/26/2013  
## Open the nav on page access.

## @noparams

\<ac:macro ac:name="html"\>  
\<ac:plain-text-body\>\<!\[CDATA\[\<script type="text/javascript"\>  
AJS.toInit(function () {  
var splitPos = AJS.$('#splitter .vsplitbar').css('left')  
if(splitPos === '0px') {  
AJS.$('#splitter-button').click();  
}  
});  
\</script\>\]\]\>\</ac:plain-text-body\>  
\</ac:macro\>


author: Barbara Boros
body: It's simple as it is:

```
Macro Name:collapsesidebarMacro Title:Collapse SidebarDescription:Collapse sidebar by default (everywhere!)Macro Body Processing:No macro bodyTemplate:## Macro title: Collapse Sidebar## Macro has a body: N## Body processing: Selected body processing option## Output: Selected output option#### Developed by: Barbara Boros## Date created: 08/28/2014## Installed by: Barbara Boros## @noparams&lt;style&gt;    #main {        margin-left: 55px !important;    }&lt;/style&gt;
```


Tags: confluence-administration