Basic Breadcrumb
A breadcrumb nav using the default navigation datasource
Description
This is a basic breadcrumb utilizing just the default Symphony navigation datasource and $current-page-id
parameter.
It does not handle url parameters, but could be modified to do so pretty easily.
XSLT
View Raw
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="UTF-8" indent="yes" method="xml" /> <!-- Basic Symphony Breadcrumb Version .1 Author: Andrew Shooner This is a basic breadcrumb utilizing just the default Symphony navigation datasource and $current-page-id parameter. It does not handle url parameters --> <!-- paste apply-templates element below where you want the breadcrumb <xsl:apply-templates select="/data/navigation" mode='breadcrumb' /> --> <xsl:template match="/data/navigation" mode="breadcrumb"> <ul class='breadcrumb'> <li><a href="/">Home</a></li> <xsl:apply-templates select="page[.//page[@id = $current-page-id]] | page[@id = $current-page-id]" mode="breadcrumb"/> </ul> </xsl:template> <xsl:template match="page" mode="breadcrumb"> <xsl:param name="base-url" select="'/'"/> <xsl:param name="this-page-url" select="concat($base-url, ./@handle, '/')" /> <xsl:choose> <xsl:when test="@id = $current-page-id"> <li><xsl:value-of select="name"/></li> </xsl:when> <xsl:otherwise> <li><a href="{$this-page-url}"><xsl:value-of select="name" /></a></li> <xsl:apply-templates select="page[.//page[@id = $current-page-id]] | page[@id = $current-page-id]" mode='breadcrumb'> <xsl:with-param name="base-url" select="$this-page-url" /> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>