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
Answer accepted
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.

I'm trying this solution but instead of applying the new style my page content is just showing the style html that makes up the macro content.  It is only showing the text when I set frameable=true so I know at least that part of the macro is working correctly.

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
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,271 views 2 13
Read article

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