Skipping Directories in Breadcrumbs

Aaron Smith's Avatar

Aaron Smith

17 Aug, 2016 08:51 PM

I have breadcrumbs on my site, but I need to skip the link for the first page after the "Home" link. How do I identify that page to remove it from the breadcrumbs?

Here's my code:
#macro (displayCrumbs $crumb $lastPage $lastFolder)
    #set ($isFolder = ($crumb.identifer.type == $_FieldTool.in("com.hannonhill.cascade.model.dom.identifier.EntityTypes").TYPE_FOLDER))
    
    #if ($lastPage.name == "index" && $lastFolder == $crumb)
        <span>${_EscapeTool.xml($crumb.metadata.displayName)}</span>
    #elseif ($crumb == $currentPage && $crumb.name != "index")
        <span>${_EscapeTool.xml($crumb.metadata.displayName)}</span>
    #elseif ($crumb.name == "/")
        ## Skip here, we are always including the home before we build the breadcrumbs
        ## <a href="$crumb.link/index">Home</a>
    #elseif ($isFolder)
        <a href="$crumb.link/index">${_EscapeTool.xml($crumb.metadata.displayName)}</a>
    #elseif ($crumb.name != "index")
        <a href="$crumb.link">${_EscapeTool.xml($crumb.metadata.displayName)}</a>
    #else
    #end
#end

Thanks!
Aaron

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM