Can I link to Confluence page and automatically collapse sidebar?

I want to iframe a Confluence page into a different website, but ideally it would be done without the sidebar open by default.

Is there a way I can manipulate the URL that I embed so the sidebar doesn't appear unless activated?

Basically the website I will be embed Confluence into has limited real estate and the sidebar takes up a lot of space.

2 answers

1 accepted

2 votes
Davin Studer Community Champion Apr 02, 2015

You could create a user macro that will override the styles of the page if a certain parameter is in the query string of the url. The below user macro example would only display the page content if the url had the value ?frameable=true at the end. Then just put the user macro on pages that you want to put in an iframe on another page. Or you could put the user macro in the page theme decorator if you want every page to be able to do this. In your iframe reference the wiki page with ?frameable=true at the end of the url and Voila!

Macro Name:
frameable

MacroTitle:
Frameable 

Macro Body Processing:
No macro body

Template:

## Developed by: Davin Studer
## Date created: 04/02/2015
## @noparams
 
#if($req.getParameter('frameable') == "true")
#set ($p = '#')
 
<style>
${p}header, ${p}footer, .ia-splitter .ia-splitter-left, ${p}labels-section, ${p}comments-section, ${p}sidebar-container, ${p}main-header, ${p}content .page-metadata {display: none !important;}
${p}main {margin-left: 0 !important; border: 0 !important; padding: 0 !important;}
body {background: ${p}FFFFFF !important;}
</style>
#end

This is incredibly helpful, thank you!

Smart and simple! Thank you fro sharing.

The only way I currently know how to do it is with javascript but that won't really help in your situation. I think you are looking for some kind of parameter that you can add in the URL to close the sidebar but I don't believe there is a parameter that does that in confluence. The other option is to go nuclear and just get rid of the sidebar completely from confluence.

 

Some info here may help you:

https://confluence.atlassian.com/pages/viewpage.action?pageId=330796984

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

309 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you