#requireResource("confluence.web.resources:breadcrumbs")

<content tag="breadcrumbs">
    #set ($breadcrumbs = $helper.breadcrumbs)
    #set ($ellipsisCrumbs = $helper.getEllipsisCrumbs($breadcrumbs))
    #set ($ellipsisShown = false)
    #set ($numCrumbs = $breadcrumbs.size())

    <ol id="breadcrumbs">
    #foreach( $breadcrumb in $breadcrumbs )
        #if ($ellipsisCrumbs.contains($breadcrumb))
            #set ($breadcrumbHidden = true)
            #if(!$ellipsisShown)
                <li id="ellipsis" title="#renderEllipsisTitle($ellipsisCrumbs)"><span><strong>&#8230;</strong></span></li>
                #set ($ellipsisShown = true)
            #end
        #else
            #set ($breadcrumbHidden = false)
        #end

        <li#if ($breadcrumbHidden) class="hidden-crumb" #end#if ($velocityCount == 1) class="first" #end><span>
        ##set ($displayTitle = $generalUtil.htmlEncode($action.getText($breadcrumb.title)))
        #set ($displayTitle = $action.getText($generalUtil.htmlEncode($breadcrumb.title)))
        ## display the last breadcrumb as text, rather than a link as this is where you are
        #if ($breadcrumb.target && $velocityCount < $numCrumbs)
            <a href="$req.contextPath$breadcrumb.target">$displayTitle</a>
        #else
            $displayTitle
        #end
        </span></li>
    #end
    </ol>
</content>

#macro(renderEllipsisTitle $breadcrumbs)
    &#8230;
    #foreach( $breadcrumb in $breadcrumbs )
        #if ($velocityCount > 1) &gt; #end
        $generalUtil.htmlEncode($action.getText($breadcrumb.title))
    #end
    &#8230;
#end
