Show last authors
1
2
3 {{toc-local/}}
4
5 = Introduction =
6
7 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.,:
8
9 [[image:attach:image2017-7-8_6-31-50.png]]
10
11 and in the standard sidebar (in Confluence 6, Global Look and Feel theme) for links to Pages, Blog, and space shortcuts:
12
13 [[image:attach:image2017-7-8_7-32-27.png]]
14
15 = Macro =
16
17 Macro settings:
18
19 * Macro Name: navlink
20 * Visibility: Visible to all users in the Macro Browser
21 * Macro Title: Navigation Link
22 * Description: Link suitable for navigation in sidebar.
23 * Categories: Navigation
24 * Macro Body Processing: No macro body
25
26 Macro code:
27
28 {{code}}
29 ## Macro title: navlink
30 ## @param address:title=Address|type=confluence-content|required=true
31 ## @param linktext:title=Link text|type=string|required=true
32 ## @param display:title=Display|type=enum|enumValues=block,inline|default=block
33 <a class="navlink" href=$paramaddress style="display: $paramdisplay;">$paramlinktext</a>
34 {{/code}}
35
36 Edit popup:
37
38 [[image:attach:image2017-7-8_10-33-41.png]]
39
40 {{warning}}
41 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.
42 {{/warning}}
43
44 = Stylesheet =
45
46 The Global Stylesheet needs some CSS settings to give the link set up by the macro its flat look and behavior:
47
48 {{code}}
49 a.navlink {
50 display: block;
51 line-height: 1.1;
52 padding: 4px 4px;
53 word-wrap: break-word;
54 }
55 a.navlink:hover {
56 background: #e5e5e5;
57 }
58 a.navlink:active {
59 text-decoration: none;
60 }
61 a.navlink:link {
62 text-decoration: none;
63 }
64 {{/code}}
65
66 This style information must be in a stylesheet because the :hover, :active, and :link settings cannot be inlined in the style attribute.
67
68 = Using It =
69
70 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"):
71
72 [[image:attach:image2017-7-8_6-51-7.png]]
73
74 pointing to a special page called _sidebar which looks like:
75
76 [[image:attach:image2017-7-8_6-58-15.png]]
77
78 *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.
79
80 = Result =
81
82 The result is quite aesthetically pleasing and works as desired:
83
84 [[image:attach:image2017-7-8_7-28-11.png]]
85
86 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".
87
88 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.

Contact