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. Links that look like this can be seen in the Admin sidebar, e.g.,:
[[image:attach:image2017-7-8_6-31-50.png]]
and in the standard sidebar (in Confluence 6, Global Look and Feel theme) for links to Pages, Blog, and space shortcuts:
[[image:attach:image2017-7-8_7-32-27.png]]
Macro settings:
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:
[[image:attach:image2017-7-8_10-33-41.png]]
Warning
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
.
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.
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"):
[[image:attach:image2017-7-8_6-51-7.png]]
pointing to a special page called _sidebar
which looks like:
[[image:attach:image2017-7-8_6-58-15.png]]
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.
The result is quite aesthetically pleasing and works as desired:
[[image:attach:image2017-7-8_7-28-11.png]]
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.