{compound-menuitem} Macro
Description
This macro creates a link to a specific Confluence feature or page relative to the current location in the wiki.
The macro combines the features of the menuitem macro, menulink macro and menuicon macro resulting in cleaner syntax and a three fold performance increase.
Each link destination abides by all applicable permissions - should the user not have sufficient permission to use the link, or simply be in a location where the link is not applicable, the body of the macro is returned un-linked (which is then usually hidden by the menuitem macro).
Requirements
This macro requires Theme Builder 3.0 or above.
Usage
{compound-menuitem:linktype|caption=text|icon=icon_name}
Parameters
| Property | Required | Default | Notes | Ver |
|---|---|---|---|---|
| default | The destination to link to (see list below) | 3.0 | ||
| caption | The link text to be displayed to the user. | 3.0 | ||
| space | current space | Optionally set the space to which the link relates. | 3.0 | |
| page | current page | Optionally set the page to which the link relates, eg. when using the "newpage" destination you can define the parent page with this parameter. | 3.0 | |
| parent | space homepage | When using the "exportMail" destination, this defines the page that will be the parent of the new page containing the exported mail message. | 3.0 | |
| link | When using the "custom" destination (see examples) this is the URL to link to. | 3.0 | ||
| toggle | When using the "toggleVisibility" destination (see examples) this is the HTML id of the tag to show/hide. | 3.0 | ||
| tooltip | The tooltip to display when the mouse hovers over the link (max: 77 chars for cross-platform compatibility) 1 | 3.0 | ||
| accesskey | An optional shortcut key for the link which can be any alphanumeric character 2 | 3.0 | ||
| target | current browser window | An optional target window or frame in which to load the link destination. | 3.0 | |
| class | Optional HTML classes to associated with the hyperlink. | 3.0 | ||
| hideanon | false | Whether to hide the link from anonymous users:
|
3.0 | |
| rel | automatic | The "rel" attribute to assign to the link. Many links get an automatic rel attribute (eg. rel="index" for the index link) and also "nofollow" rels to prevent search engines following links that alter content, etc. | 3.0 | |
| icon | none | the icon to use as one of SPACEKEY:pagename^filename.ext/custom url/inbuilt icon (use 'noicon' to prevent an icon being displayed) | 3.0 | |
| imginside | false | Defines whether the icon (if present) should be within the link tag or outside it. This is useful when displaying just an icon link on the main menu bar.
|
3.0 | |
| size | 16 | When used with the compound-menuitem macro, defines the pixel size (same for width and height) of the icon if shown. | 3.0 | |
| layout | When using the use-layout location, defines the layout ID to use. | 3.0 | ||
| latch | false | When using the use-layout location, determines whether the layout should be used temporarily for the resulting page view or latched for all subsequent page views.
|
3.0 | |
| item | 3.0 | |||
| flag | The macro is rendered only if one or more of the specified flags are set. See Working with Flags for more details. | 3.3.6 | ||
| notflag | The macro is rendered only if none of the specified flags are set. See Working with Flags for more details. | 3.3.6 |
| Reference | Notes |
|---|---|
| 1 | When using the link in a menu, tooltips will only be shown if enabled in theme configuration. In all other formats, the tooltip will always be shown when the mouse hovers over the link. |
| 2 | When using links inside menus, you can also prefix a letter in the link text with an "_" to define the access key - this letter will then be underlined when displayed in the menu. Access keys only work when the associated item is visible on screen. |
Caption Fields
Some link locations provide fields for captions which get automatically replaced when the links are displayed based on the state of the link location.
For example, the %page% field will be replaced with either "page" or "news" depending on whether you're looking at a page or a blog post.
| Field | Link Destinations | Notes |
|---|---|---|
| %page% | information, edit, remove, favourite, favouritespace, watch, watchspace, watchpage | Displays either "page", "news" or "space" as applicable to the content you are currently viewing. |
| %count% | spaceattachments, children, comments, pageattachments | Displays the number of attachments, children or comments as applicable to the link location. |
| %user% | profile, userspace | Displays the users full name. |
| %space%, %Space% | activity | Displays "space" or "site" - the %Space% field capitalises the first letter, eg. "Space" or "Site". |
| %add% | favourite, favouritespace, watch, watchspace, watchpage | Displays "Add" or "Remove" depending on whether the content is in your favourites or watched. |
| %watching%, %watch% | watch, watchspace, watchpage | Displays "Watching" or "Watch" (%watching%), "Watch" or "Unwatch" (%watch) depending on whether you are watching the content. |
Link Destinations
The following link destinations can be used in the compound-menuitem macro.
The Ver column denotes which version of Theme Builder is required.
Examples
Hints and Tips
You can create keyboard shortcuts by adding empty menulinks to a panel in builder (eg. title or footnotes panel, etc), for example:
{compound-menuitem:edit|tooltip=Edit this content|accesskey=e|caption=Edit this %page%}
This would add the keyboard shortcut "Alt+E" to all screens that can be edited (eg. blogposts, pages, etc). The shortcut would only be available if the current user has sufficient privileges to edit the page, etc.


Comments (46)
Jun 25, 2009
Meredith Raymond says:
How do you add a ---- between menu items? I know it must be simple, but I can n...How do you add a ---- between menu items? I know it must be simple, but I can not find the syntax.
Jun 26, 2009
Jessica Britton says:
Try this: {menuseparator}Try this:
{menuseparator}Jun 26, 2009
Alain Moran says:
menuseparator macromenuseparator macro
Jun 26, 2009
Meredith Raymond says:
Much appreciated!Much appreciated!
Jul 13, 2009
Louise Albert says:
Is it possible to link to an anchor? I can't get it to work. {compound-menuit...Is it possible to link to an anchor? I can't get it to work.
{compound-menuitem:wikipage|#anchor|caption=Link text}Dec 30, 2009
Andrew Brister says:
This is what I tried. It didn't work either. {compound-menuitem:wikipage|spa...This is what I tried. It didn't work either.
{compound-menuitem:wikipage|space=rvt|page=modeling|link=#building assembly best known practices|caption=Modeling Techniques}Is it possible to link to a page anchor?
Dec 30, 2009
Alain Moran says:
No that's not possible.No that's not possible.
Dec 30, 2009
Andrew Brister says:
grumble grumble mumble mumble. Okay. Thanks Alain. I figured as much. Although I...grumble grumble mumble mumble. Okay. Thanks Alain. I figured as much. Although I could use regular wiki markup inside a menulink to get to the anchor, right?
Dec 30, 2009
Alain Moran says:
Sadly no One thing you might like to try ... is using the %currenturl% menulin...Sadly no
One thing you might like to try ... is using the %currenturl% menulink replacement:
{compound-menuitem:custom|link=%currenturl%#anchor|caption=blah}
However if your current url contains an anchor then I suspect it will break, the only way to make this happen reliably is going to be the addition of an 'anchor' menulink type.
That's not likely to happen any time soon though since we have our work cut out for us with getting builder 4 production ready.
Dec 30, 2009
Andrew Brister says:
Okay. Well, it's worth a try. Thanks Alain.Okay. Well, it's worth a try. Thanks Alain.
Sep 11, 2009
Jon Blazquez says:
Hi! I would like to know how to insert the triangular arrows that expands and co...Hi!
I would like to know how to insert the triangular arrows that expands and collapes which are used in this page (and in most pages of Adaptavist Web), i.e. : In Examples section in this page "Linking to a wikipage".
It must be simple but I dont's find it!
Thank you!
Sep 14, 2009
Herman de Boer says:
Hi Jon, use the {expand} macro. See the documentation at Atlassian, here. Rega...Hi Jon,
use the {expand} macro. See the documentation at Atlassian, here.
Regards, Herman.
Sep 14, 2009
Jon Blazquez says:
Thanks Herman! I knew It should be easy! Cheers, JonThanks Herman!
I knew It should be easy!
Cheers,
Jon
Oct 22, 2009
Jeff WIlbert says:
Jon – You can also use the Cloak and Toggle Cloak macros documented here ...Jon –
You can also use the Cloak and Toggle Cloak macros documented here on the Adaptavist site.
Here to help,
Jeff
Oct 23, 2009
Jon Blazquez says:
Thanks!!!Thanks!!!
Sep 29, 2009
Jonas Lindström says:
Hi! Thanks for this great plugin - it makes building and modifying themes a bree...Hi! Thanks for this great plugin - it makes building and modifying themes a breeze.
However I am missing two locations/functions for compound-menuitem:
The latter function is rather central, but is for some reason blatantly absent from the list of functions! Have I missed something, or can it be replaced by something else?
Sep 29, 2009
Alain Moran says:
I think you are looking for 'notationguide' and 'move'I think you are looking for 'notationguide' and 'move'
Sep 30, 2009
Jonas Lindström says:
Well I'll be.... I never thought of just trying them out! However, the 'move' f...Well I'll be.... I never thought of just trying them out!
However, the 'move' function doesn't display in the menu at all. Here's the code I'm using:
{menubar:id=pageactions} {menu}{menuicon:gear}Tools {compound-menuitem:copy|icon=documents_new|caption=Copy this %page%} {compound-menuitem:move|caption=Move this %page%} {compound-menuitem:remove|icon=document_delete|caption=Remove this %page%} {menu} {menubar}For some reason, Copy and Remove are showing just fine. Move isn't.
Mar 22
John Bowersox says:
I've tried the move option as well as the menu item does not show up on our Conf...I've tried the move option as well as the menu item does not show up on our Confluence instance either.
We are using Confluence 3.0.1 and Theme Builder 3.3.6-M4-conf210-SNAPSHOT.
The option is not a must have, but it would be nice as we had it with the default theme and some users have noticed it is now missing.
Oct 05, 2009
Christian Veillette says:
How can I remove the bullet added before the compound menu item. I have tried ...How can I remove the bullet added before the compound menu item.
I have tried
as the class for the li is menuitem but it does not appear to work.
Regards
CV
Oct 05, 2009
Alain Moran says:
see the documentation above flat=truesee the documentation above
flat=true
Oct 06, 2009
Christian Veillette says:
Thanks Alain That works I must be blind cause I do not see a flat parameter abov...Thanks Alain
That works
I must be blind cause I do not see a flat parameter above. Browser find function did not either
Regards
CV
Oct 05, 2009
J Lyse says:
Hi, I'we tried searching to find the compund-menuitem for "User Status" update. ...Hi, I'we tried searching to find the compund-menuitem for "User Status" update.
In the default theme it's called "Update Status..."
Tips?
Oct 05, 2009
Alain Moran says:
Use a menulink alias to point to the confluence web itemUse a menulink alias to point to the confluence web item
Oct 06, 2009
J Lyse says:
I was informed of the Menulink Aliases once before, it slipped my mind this time...I was informed of the Menulink Aliases once before, it slipped my mind this time..
Thanks for the reply
Aug 16
James Brown says:
Hi Alain- I too was trying to create a menu item for "Update Status". I went to ...Hi Alain-
I too was trying to create a menu item for "Update Status". I went to the URL you linked to, but still didn't understand how you would go about creating that link? This is the menu I currently have, and I would want it to appear in the list. I'm very new to Confluence, so a little more detailed help would be perfect!
{menu}%fullname% {compound-menuitem:profile|icon=id_card|caption=Preferences: %fullname%} {compound-menuitem:history|icon=clock|caption=History} {compound-menuitem:logout|icon=door2|caption=Log out} {menu}Aug 20
James Brown says:
Can anyone please help me with this. I have been searching everywhere. I know it...Can anyone please help me with this. I have been searching everywhere. I know it is possible because they have it as a menu option on this site.
Aug 20
Alain Moran says:
Sorry I've been busy with paid work, if you need support within any reasonable t...Sorry I've been busy with paid work, if you need support within any reasonable timescale please consider taking out a support contract.
Create a 'plugin' menulink alias with 'User Status' as the plugin and 'Update user status menu item' as the link.
When time permits (or when someone pays for it) we will be overhauling the menulink alias definition page to allow you to select the menulink by where it appears in the default confluence theme as well as the current plugin based route.
Aug 20
James Brown says:
Hi Alain- Thanks for the response. I tried doing that, but it wasn't working. It...Hi Alain-
Thanks for the response. I tried doing that, but it wasn't working. It was just creating a duplicate emailpage alias instead. I figured out that the Plugin was 4.1.1 rather than the latest 4.1.3. I updated it and everything is working as expected now. Thanks for your help.
Oct 28, 2009
Guy Davenport says:
I am trying to add a user profile, login/logout to the navigate just in front of...I am trying to add a user profile, login/logout to the navigate just in front of the standard icons/links, but I get some unexpected results. My navigator content is
{table:width=100%|cellpadding=0|cellspacing=0|border=0} {tr} {td:valign=middle} {builder-breadcrumbs} {td} {td:align=right|valign=middle} {compound-menuitem:profile|icon=id_card|caption=%fullname%} {compound-menuitem:login|icon=user1_into|caption=Log in} {compound-menuitem:logout|icon=door2|caption=Log out} {builder-show:context=page,blogpost|mode=view} {builder-favicon} {builder-watchicon} {compound-menuitem:edit|flat=true|imginside=true|icon=document_edit|tooltip=Edit this %page%} {compound-menuitem:remove|flat=true|imginside=true|icon=document_delete|tooltip=Remove this %page%} {compound-menuitem:copy|flat=true|imginside=true|icon=documents_new|tooltip=Copy this %page%} {compound-menuitem:pageattachments|flat=true|imginside=true|icon=document_attachment|tooltip=View %page% attachments} {builder-show} {td} {tr} {table}The page is http://wiki.cimmyt.org/confluence/display/MBP/Home
Oct 28, 2009
Guy Fraser says:
You probably want to add flat=true to the compound-menuitems you added for login...You probably want to add flat=true to the compound-menuitems you added for login/etc (some of the items further down already have the param).
Oct 28, 2009
Guy Davenport says:
Yes, that worked. ThanksYes, that worked. Thanks
Oct 29, 2009
Andrew Brister says:
{menubar:id=sitenav|class=siteNav} {compound-menuitem:home|space=rvt|caption...{menubar:id=sitenav|class=siteNav} {compound-menuitem:home|space=rvt|caption=Revit|class=currentMenuItem} {compound-menuitem:home|space=edu|caption=Education} {menubar}Above is the simplified code I'm struggling with. The idea is that the entire menu is one color, except for the currentMenuItem.
I have been able to get the menubar class to respond properly with my css. This is great, because I get to change the background color of the div associated with the class... My problem is the class in the compound-menuitem. I can't seem to get the class to respond in my css. I am sure I'm not doing it correctly. Here's my css...
.currentMenuItem td { background-color: #F4F5ED; }The reason for using the td is because I found this in the html:
I know I've got something wrong. But I was under the impression that if you were to assign the class, it could be called out with the same format as the other classes. I think though compound-menuitems are different because they are sub"things".
Anyway, I haven't been able to find any documentation on how to write the class for a compound-menuitem. Thanks in advance for the help. I can elaborate if needed.
Thank you
-AB
Oct 30, 2009
Jonas Lindström says:
Looks to me like you should instead write td.currentMenuItem { background-c...Looks to me like you should instead write
td.currentMenuItem { background-color: #F4F5ED; }in the css file.
Oct 30, 2009
Andrew Brister says:
Thank you. I'm still learning my way around css, and this is just one of those t...Thank you. I'm still learning my way around css, and this is just one of those things. Thanks very much Jonas.
Nov 14, 2009
Melissa C. Wood says:
I'm a bit stuck trying to resolve functional & style issue with my menubar a...I'm a bit stuck trying to resolve functional & style issue with my menubar and am hoping you can help. Everything worked perfectly on my local instance of Confluence while I was developing it, but now that I've migrated everything to our production server something has broken and I can't seem to resolve it.
I have a menubar with embedded compound-menuitem and menu macros used for submenus. I need the links that make up the menu "tabs" to link to a wikipage (even if it has a submenu) and I need these same tabs to utilize a background image for the default state and a different background-image for the hover and active states.
Here's part of my menubar code. "Home" and "About the Nite" should display as the menu "tabs".
{menubar:id=nav1|class=nav1} {menuitem}[nite:Home]{menuitem} {menu}[nhin:About the Nite] {menuitem}[nite:Background]{menuitem} {menuitem}[nite:Benefits of the Nite]{menuitem} {menuitem}[nite:Nite Participants]{menuitem} {menu} {menubar}Here's the applicable CSS code. All of the images have been attached to a wikipage and then referenced via their confluence URL. The "nite_nav1BkgdUp.gif" image displays on all tabs but the I can't get the "nite_nav1BkgdDown.gif" to display on the hover and active states. I changed the "down" image to the "up" image and it displayed the "up" image for the hover & active states accordingly... but when I checked the URL of the "down" image and swapped it back into the hover & active states... nothing! Makes no sense!
.nav1 div.dynarch-horiz-menu { border: 0px solid #FFFFFF; color: #1D305F; cursor:hand; } .nav1 div.dynarch-horiz-menu table tr td, .nav1 div.dynarch-horiz-menu table tr td.explicit-action { background-color: #E4E4E4; background-image: url(/download/attachments/1212420/nite_nav1BkgdUp.gif); background-position: top left; background-repeat:repeat-x; border-left: 2px solid #FFFFFF; border-right: 2px solid #FFFFFF; color: #1D305F; font-size: 1.1em; padding: 3px 10px; vertical-align: middle; } .nav1 div.dynarch-horiz-menu table tr td:hover, .nav1 div.dynarch-horiz-menu table tr td:active, .nav1 div.dynarch-horiz-menu table tr td.activesection { background-color:#538FB3; background-image: url(/download/attachments/1212420/nite_nav1BkgdDown.gif); background-position: top left; background-repeat:repeat-x; color: #FFFFFF; } .nav1 div.dynarch-horiz-menu table tr td.explicit-action:hover, .nav1 div.dynarch-horiz-menu table tr td.explicit-action:active { background-color:#538FB3; background-image: url(/download/attachments/1212420/nite_nav1BkgdDown.gif); background-position: top left; background-repeat:repeat-x; color: #FFFFFF; } div.dynarch-horiz-menu table tr td.hover table, div.dynarch-horiz-menu table tr td.active table { } div.dynarch-horiz-menu table tr td.separator div { } div.dynarch-popup-menu { background-color: #FFFFFF; border: 1px solid #909090; color: #1D305F; margin: 1px 2px; padding: 0; } div.dynarch-popup-menu tr.item{ color: #1D305F; border-top: 1px solid #ABA79B; border-bottom: 1px solid #ABA79B; padding: 1px 3px; } div.dynarch-popup-menu tr.item.hover { background-color: #81C1E5; } div.dynarch-popup-menu tr.item.active { background-color: #81C1E5; } div.dynarch-popup-menu tr.separator td div { background-color: #ABA79B; margin: 0; padding: 0; }And I'm curious... can I build my CSS based on the HTML rendering output? Meaning, when I "View Page Source" in my browser, the styles listed above are nowhere to be found in the rendered output (except for "nav1"), thus making building an accurate stylesheet a bit difficult. Or could you please provide the source code w/in the builder scripts where these styles exist to help us troubleshoot our code?
Thanks TONS for all the help!
Dec 15, 2009
Andrew Brister says:
When using the compound menu item with wikipage and page: {compound-menuitem:...When using the compound menu item with wikipage and page:
{compound-menuitem:wikipage|page=Template Selector|icon=icon.png}How can I keep the words "Template Selector" (the name of the page I am linking to) from showing. All I want to see is the icon. I can't figure out why this would become the caption. Is there any way to remove this caption? I haven't defined a caption at all, and I'd like to keep it that way.
Thank you.
Dec 17, 2009
Jonas Lindström says:
Try using the caption parameter without a value. Like so: {compound-menuitem:w...Try using the caption parameter without a value. Like so:
{compound-menuitem:wikipage|page=Template Selector|icon=icon.png|caption=}Mar 29
Pierre-Vincent GUILLOT says:
Is it possible to use menuitem macro and newpage parameter to add a page based o...Is it possible to use menuitem macro and newpage parameter to add a page based on a specific template? Actually, i'm looking for a parameter to force user to create a page with a specific template...
May 06
Udo Timpe says:
Why is the menuitem 'exportpdf' not visible for anonymous users? How can I confi...Why is the menuitem 'exportpdf' not visible for anonymous users? How can I configure this?
Thanks
Udo
May 06
Guy Fraser says:
You need to ensure they have 'Export' permission in Space Permissions.You need to ensure they have 'Export' permission in Space Permissions.
May 06
Udo Timpe says:
Thanks, found it.Thanks, found it.
May 24
frank knobloch says:
exportMail and emailpage is not available (anon and authenticated). Do i miss so...exportMail and emailpage is not available (anon and authenticated). Do i miss some macros?
May 31
Tom Wolff says:
I think this is a new, unfortunate, behavior with "compound-menuitem:newpage" in...I think this is a new, unfortunate, behavior with "compound-menuitem:newpage" in the Title area since we recently upgraded to Confluence 3.1.2 and TB 4.0.2.
With {compound-menuitem:newpage|flat=true|icon=document_add|caption=Add Topic}, the new page is now always added below the top level page in space rather than the below the current page as was and should be the default. This is particularly bothersome when people try to add a new topic to a Forum while viewing the top level Forum page, and the new entry then isn't added as a child of that Forum page. Either the user has to use the Location function on the add/edit page, something users don't even realize they now have to do, or as admin, I have to move the page to the forum hierarchy.
Is there something I can do to fix this?
Aug 18
James Brown says:
I'm trying to create a menu item that links to create a child page of a specific...I'm trying to create a menu item that links to create a child page of a specific parent. I was going to use the Linking Plugin from CustomWare. That would allow me to create links to all of the specific pages I want. The problem I am having is how do I combine the add-page macro with the compound-menuitem macro? I want it to appear in a dropdown menu with a bunch of other links that I have in there now.
Aug 20
Alain Moran says:
The linking plugin is often not compatible with the builder panels, it makes the...The linking plugin is often not compatible with the builder panels, it makes the assumption that it is being run from within a page & this can cause unexpected results ... the menulink/compound-menuitem links to everywhere that the linking plugin does (and more), you should use that instead.