Skip to end of metadata
Go to start of metadata

Menus can also be customised at space level using similar techniques...

Embedding links from a wiki page

Menus are constructed using unordered lists of links - as such, you can create a list of links on a page then embed the links within your menus by using the include macro or import macro (see 1 - Space Level Panel Content for more details).

For example, let's say you have some menu notation on a page called "Space Menu" in your wiki:

{menu}View
 {compound-menuitem:news|icon=news|caption=News}
 {compound-menuitem:recent|icon=new|caption=Recent updates}
 {compound-menuitem:RSS|icon=rss|caption=RSS feed builder}
 {menuseparator}
 {compound-menuitem:index|icon=index|caption=Index}
 {compound-menuitem:map|icon=document_into|caption=Site map}
 {compound-menuitem:labels|icon=tag_purple|caption=Labels}
 {menuseparator}
 {compound-menuitem:mail|icon=mail|caption=Mail}
 {menuseparator}
 {compound-menuitem:children|caption=Show children (%count%)}
 {compound-menuitem:comments|caption=Show comments (%count%)}
{menu}

Because we're using the context-sensitive compound-menuitem macro, we will need to "import" (rather than "include") the notation in to the menu bar.

In the menu panel, use syntax like the following:

{menubar}

 ... various static menu items ...

 {builder-show:page=Space Menu}
  {import:Space Menu}
 {builder-show}

 ... more static menu items ...

{menubar}

If the "Space Menu" page exists, it'll be imported directly in to your menu.

If you're not sure whether the list of links will contain valid markup, you should wrap the imported content in the wikimenu macro:

 {builder-show:page=Space Menu}
  {wikimenu}
   {import:Space Menu}
  {wikimenu}
 {builder-show}

The wikimenu macro sanitizes it's content, for example removing unwanted line spaces, invalid markup, etc.

Showing or hiding based on context

Using the builder-show macro and/or builder-hide macro, you can show and hide blocks of menu content based on context.

For example, if we wanted our Space Menu from the example above to only appear on the home page, we could use:

 {builder-show:page=Space Menu|title=Home}
  {wikimenu}
   {import:Space Menu}
  {wikimenu}
 {builder-show}

The page parameter checks to see if the page exists and the title parameter checks to see if the current page is called "Home". The menu will only be shown if both conditions are met.

  • No labels