Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I always show the left sidebar on some pages when using the Documentation theme?

Armon Tiongco September 25, 2013

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,

2 answers

1 accepted

2 votes
Answer accepted
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2013
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2013

You could put this into an HTML macro in the page.

<script type="text/javascript">
AJS.toInit(function () {
	var splitPos = AJS.$('#splitter .vsplitbar').css('left')
	if(splitPos === '0px') {
		AJS.$('#splitter-button').click();
	}
});
</script>
Armon Tiongco September 25, 2013

Hi David,

Can you please explain further how this code helps?

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

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,

Armon Tiongco September 25, 2013

it works! Thank you so much! :)

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2013

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>

0 votes
Barbara Boros August 27, 2014

It's simple as it is:

Macro Name:
collapsesidebar

Macro Title:
Collapse Sidebar

Description:
Collapse sidebar by default (everywhere!)

Macro Body Processing:
No macro body

Template:
## 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;

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events