Can I link to Confluence page and automatically collapse sidebar?

Gary McCormick April 2, 2015

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
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.
April 2, 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
Gary McCormick April 3, 2015

This is incredibly helpful, thank you!

Volodymyr Krupach
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.
August 18, 2016

Smart and simple! Thank you fro sharing.

Troy Moreland February 15, 2019

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.

0 votes
Alex Yasurek
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.
April 2, 2015

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
TAGS
AUG Leaders

Atlassian Community Events