The sibling tabs user macro for Confluence gives a simple way to create a horizontal tabbed navigation system between sibling pages in a Confluence space.

Here’s a video demo:

Here’s the code and how to apply it to your Confluence system:

In Confluence Admin | User Macros, create a new user macro and paste in:


## Macro title: Sibling Tabs
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: David Simpson <david@appfusions.com>
## Date created: 2013-10-01
## Installed by: My Name
##
## Use this on each sibling page to add tabbed navigation between sibling pages
## DO use this when there are 2-6 sibling pages with short page title
##
## DO NOT use this when there are more than 6 sibling pages or when the page titles are long

## @noparams #set ($parent = $content.getParent()) <div class="aui-tabs horizontal-tabs" data-aui-tab-events-bound="true" data-aui-responsive="" role="application"> <ul class="tabs-menu"> #foreach ($child in $parent.getChildren()) <li class="menu-item#if ($content.id == $child.id) active-tab#end"> <a href="$req.contextPath$child.urlPath"><strong>$webwork.htmlEncode($child.displayTitle)</strong></a> </li> #end </ul> <div class="tabs-pane active-pane"></div> </div>

Simply add the Sibling Tabs user macro whenever you want horizontal tabs — don’t forget to add the macro to each of the pages ;)

Update 2013-10-22:

Olha Vdovych asked me via email how to limit the number of tabs and how to get the order of the tabs to be consistant with the natural ordering within Confluence.

I've updated the user macro below for both requests:


## Macro title: Sibling Tabs
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: David Simpson <david@appfusions.com>
## Date created: 2013-10-01
## Installed by: My Name
##
## Use this on each sibling page to add tabbed navigation between sibling pages
## DO use this when there are 2-6 sibling pages with short page title
##
## DO NOT use this when there are more than 6 sibling pages or when the page titles are long
## @noparams

#set($count = 0)
#set ($parent = $content.getParent())

<div class="aui-tabs horizontal-tabs" data-aui-tab-events-bound="true" data-aui-responsive="" role="application">
  <ul class="tabs-menu">
    #foreach ($child in $parent.getSortedChildren())
      #if ($count < 6) ## just display the 1st 6 siblings
        <li class="menu-item#if ($content.id == $child.id) active-tab#end">
          <a href="$req.contextPath$child.urlPath"><strong>$webwork.htmlEncode($child.displayTitle)</strong></a>
        </li>
        #set($count = $count + 1)
      #end
    #end
  </ul>
  <div class="tabs-pane active-pane"></div>
</div>