Creating Menus
This tutorial explains how to create menus in Theme Builder 3.x...
What's New?
Theme Builder 3 introduces a new [USERGUIDE:compound-menulink macro] which makes menu notation cleaner and easier as well as making your menus much faster (2/3rds faster compared to the previous syntax).
You can still use the old notation as described in Creating Menus 2.x but we highly recommend porting any existing menus over to use the new compound-menuitem macro as shown in this tutorial.
Overview
Menus are created by using one or more Menu Macros. An example of a very basic menu is shown below:
Which results in:
This notation can be used within theme panels and also within wiki pages.
Note: Menus will only work in spaces or areas of the site that have been themed with the Theme Builder plugin (as it includes the necessary JavaScript and CSS files that are required by the menus).
The Menu Bar
To define the top-level links on the menu bar, the following notation should be used:
Which results in:
You'll notice that we've used the [USERGUIDE:compound-menulink macro] to create the link to the home page. This macro allows you to reliably link to all key locations and features within Confluence and a range of third party add-ons. By linking to the home page as shown above, the link will always work regardless of what the home page is called or even if it's renamed at a later date.
Pop-Up Menus
To add pop-up menus to the menu bar links, use the menu macro:
Which results in:
In the example above, when you hover the mouse over "Builder" you'll see a pop-up menu containing two items. You can also click the "Builder" link to go to the page called "Builder".
The item that displays the pop-up menu ("Builder" in the example above) does not necessarily need to be an active link, for example you could use:
Which results in:
When you hover over "Builder Versions" the pop-up menu will still be displayed.
submenus
To add submenus to items on a pop-up menu, use the submenu macro. For example, to add a submenu to to the Builder 3.x item, the following notation is used:
Which results in:
When you hover over the Builder 3.x item, a submenu will be shown.
You can add submenus to your submenus using the sub-submenu macro, for example:
Which results in:
Adding links to external sites
When adding links to external sites, you should use the [USERGUIDE:compound-menulink macro] as shown below:
Which results in:
This format ensures that the link is output in a format the menu understands - if you were to use normal Confluence wiki notation for an external link, it sometimes won't work depending on which version of Confluence you are using.
View and Edit Menus
Theme Builder includes default View and Edit menus that contain links to all common Confluence functionality. These can be inserted using the viewmenu macro and editmenu macro and are an easy way to quickly ensure that your menu provides access to key features of the wiki.
For example, to add the View menu to you menu bar, use the following notation:
Which results in:
You can fully customise the View and Edit menus by editing their wiki notation on the Menus Tab.
You do not need to use these macros if you don't want to - you could chose to add the various links to any part of your menu.
Menu Separators
You can add separator bars to your menus using the menuseparator macro:
Which results in:
You can add spacers in both the menu bar, pop-up menus, submenus and sub-submenus.
On-screen text and Tool Tips
You can use different on-screen text and tool tips for menu items using the following notation:
Which results in:
As you can see, only the first two items have a tooltip, we've not added a tooltip to the Builder 3.x link.
Note: Tool tips will only be shown if enabled in the Menu Settings section of Theme Configuration.
Menu Housekeeping
Another benefit of the menu macros is that they will automatically adapt to user permissions (eg. can the user view the page being linked to) and automatically remove items that are not applicable.
For example, the page "Foo" does not exist in this space:
When the menu is rendered you'll see this:
As you can see, the "Foo" menu item has been removed and this also resulted in the now useless separator being removed.
In cases where a pop-up menu, submenu or sub-submenu is empty (due to invalid items being removed), those levels of the menu will also be removed as applicable.
Hints and Tips
You can generate menus automatically using any macro which outputs an unordered bullet list. For more information and examples, see our tutorial on Automated Menu Creation.
See Also
The following menu macros are available:
- compound-menuitem macro — This macro creates a link to a specific Confluence feature or page relative to the current location in the wiki.
- editmenu macro — inserts the contents of the edit menu as defined in theme config into a menu definition.
- menu macro — creates an item in your menu
- menubar macro — an extremely powerful and flexible macro that allows you to create superb on-screen navigation tools
- menuicon macro — creates an icon for use within the menu
- menuitem macro — used for containing individual menu items
- menulink macro — This macro creates a link to a specific Confluence feature or page relative to the current location in the wiki.
- menuseparator macro — used for inserting separators between menu items
- sub-submenu macro — used to embed a submenu within a submenu
- submenu macro — used to embed a submenu within a menu
- viewmenu macro — inserts the contents of the view menu as defined in theme config into a menu definition.
- wikimenu macro — used to embed wiki notation menus and the output from other macros
There are also several other tutorials in this section:
And you should also check out the Menus Tab in the Layout Manager.
Updated by thincprojects Intranet Admin (Nicole/Daniel)
Dec 18, 2007 03:44
Adaptavist, Just letting you know there's an error on this page. Submenus are used as {submenu} not as {sub-menu} as in your example, halfway down the page. BTW This wasted about 40 minutes of my time, before I found the answer to my problem. Love the application, but documentation needs some work. It can be very frustrating. Cheers N
Oops - thanks for spotting that - page updated.
Thanks Guy. Appreciate the quick fix.
Good morning,
I would like to link create a menuitem to link to the officeconnector " Edit in word". what is the menu item for it. thanks. In the future how do i find out what confluence menu item names are
Nana