Dashboard > Atlassian FAQ - JIRA Confluence Crowd Bamboo > ... > Confluence > Displaying a navbar only when viewing pages in a Confluence theme
  Atlassian FAQ - JIRA Confluence Crowd Bamboo Log In | Sign Up   View a printable version of the current page.  
  Displaying a navbar only when viewing pages in a Confluence theme

Added by Jonathan Appel [CustomWare] , last edited by Jonathan Appel [CustomWare] on Aug 09, 2007  (view change)
Labels: 
(None)

Question

How do I get certain elements of my theme to only show up when I'm viewing a Confluence page?

Answer

Note: This answer applies to Confluence v2.5.4 but may also be relevant to other versions.

When creating a Confluence theme which restricts the dimensions of Confluence's content areas, some pages can become "squished". For example, a left hand side navigation bar of 200px in a theme which retricts a Confluence page width to 500px will cause the page to display incorrectly when trying to edit a page using the rich text editor (as there are a number of icons which need to be included inline on the page).

To avoid this, it is preferable to include such a sidebar only when browsing the "view" perspective of a page (and not other perpectives such as "info" or the space browser). An example of this can be seen on the Ride for Sick Kids website, screenshots below.

(view as slideshow)
     
  Info view of same page, without navbar.   Page view, showing a navbar (highlighted in red).
 

This can be achieve through editing the themes page.vmd file to include content only in the "view" mode.

...
...

#parse ("/template/includes/actionerrors.vm")

#*
    Diplay page based on mode: currently 'view', 'edit', 'preview-edit', 'info' and 'attachments.
    See the individual page templates (viewpage.vm, editpage.vm, etc.) for the setting of the mode parameter.
*#
## VIEW

#if ($mode == "view")

    #set ($labelable = $page)
                        
    #permitSearchEngines()

    #if ($helper.isHistoricalVersion())
        <content tag="suppressPdfLink">true</content>
    #end
    #if ($helper.isHistoricalVersion() || $helper.action.navigatingVersions)
        #versionInfo()
    #end

    <div class="wiki-content" style="padding: 0px 5px 5px 5px;">
        $body
    </div>
    
...
...
Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators