Skip to end of metadata
Go to start of metadata

Contents

Introduction

The Navigation Link macro comes from the desire to provide links that have a flat look with menu style behavior and could be used in the Confluence sidebar and pages. These kinds of links show up in the Confluence configuration pages ("Manage Referrers"):

and in the sidebar (in Confluence 6, Global Look and Feel theme) for links to Pages, Blog, and space shortcuts:

Macro

Macro settings:

  • Macro Name: navlink
  • Visibility: Visible to all users in the Macro Browser
  • Macro Title: Navigation Link
  • Description: Link suitable for navigation in sidebar.
  • Categories: Navigation
  • Macro Body Processing: No macro body

Macro code:

## Macro title: navlink
## @param address:title=Address|type=confluence-content|required=true
## @param linktext:title=Link text|type=string|required=true
## @param display:title=Display|type=enum|enumValues=block,inline|default=block
<a class="navlink" href=$paramaddress style="display: $paramdisplay;">$paramlinktext</a>

Edit popup:

When using the macro in the sidebar, it is necessary to provide the path part of the URL. E.g., /display/MISC/MyPage, otherwise the link will something like /display/MyPage.

Stylesheet

The Global Stylesheet needs some CSS settings to give the link set up by the macro its flat look and behavior:

a.navlink {  
display: block;  
line-height: 1.1;  
padding: 4px 4px;  
word-wrap: break-word;  
}
a.navlink:hover {  
background: #e5e5e5;  
}
a.navlink:active {  
text-decoration: none;  
}
a.navlink:link {  
text-decoration: none;  
}

This style information must be in a stylesheet because the :hover:active, and :link settings cannot be inlined in the style attribute.

Using It

For use in the sidebar, I disable the sidebar links that can be configured using the "Space Tools → Configure sidebar" and customize the space-specific sidebar ("Space tools → Look and Feel"):

pointing to a special page called _sidebar which looks like:

*Because some of the content (e.g., contacts, spaces) in the _sidebar is reused in other spaces, the actual _sidebar page uses the IncludePage macro to pull in separate _contacts and _spaces pages which are in a different space set up for such things.

Result

The result is quite aesthetically pleasing and works as desired:

Using the macro and _sidebar page, the sidebar benefits from a menu like look and feel and can also be tailored more fully than is possible using "Space tools → Configure sidebar".

Although the focus has been on the sidebar, the macro can be used in regular pages and be combined with, e.g., panels and tables, to provide a menu like look and feel.

  • No labels