Skip to content

Instantly share code, notes, and snippets.

@dvdsmpsn
Last active December 11, 2017 06:45
Show Gist options
  • Save dvdsmpsn/3914738 to your computer and use it in GitHub Desktop.
Save dvdsmpsn/3914738 to your computer and use it in GitHub Desktop.
Sibling Tabs User Macro
#### 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 consistent 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) ## remove this line to display all siblings
#set ($parent = $content.getParent())
<div class="aui-tabs horizontal-tabs">
<ul class="tabs-menu">
#foreach ($child in $parent.getSortedChildren())
#if ($count < 6) ## just display the 1st 6 siblings ## remove this line to display all 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) ## remove this line to display all siblings
#end ## remove this line to display all siblings
#end
</ul>
<div class="tabs-pane active-pane"></div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment