h1. sitemap
With the Sitemap-Plugin you can easy add a Sitemap to your website.
Howto?
1. Create a xsl-file "sitemap.xsl" with the following content:
{code}
<?xml version="1.0" encoding="utf8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xhtml">
<xsl:include href="master.xsl"/>
<xsl:variable name="sitemapPlugin" select="/bx/plugin[@name='sitemap']"/>
<xsl:template name="content">
<h1>Sitemap</h1>
<xsl:apply-templates select="$sitemapPlugin/sitemap/collection[display-order and display-order > 0]" mode="sitemap">
<xsl:sort select="display-order" order="ascending"/>
<xsl:with-param name="level" select="'1'"/>
</xsl:apply-templates>
<!-- <xsl:apply-templates select="$sitemapPlugin/sitemap/collection[not(display-order) and not(@uri='/intro/')]" mode="sitemap">
<xsl:with-param name="level" select="'1'"/>
</xsl:apply-templates>
-->
</xsl:template>
<xsl:template match="item" mode="sitemap">
<xsl:variable name="postfix" select="concat('.',$lang,'.xhtml')"/>
<xsl:if test="contains(@uri,$postfix)">
<li>
<a href="{concat($webrootLangW,../@uri,substring-before(@uri,$postfix),'.html')}">
<xsl:value-of select="display-name" disable-output-escaping="yes"/>
</a>
</li>
</xsl:if>
</xsl:template>
<xsl:template match="collection" mode="sitemap">
<xsl:param name="level" select="level"/>
<xsl:choose>
<xsl:when test="$level = 1">
<h3>
<a href="{concat($webrootLangW,@uri)}">
<xsl:value-of select="display-name" disable-output-escaping="yes"/>
</a>
</h3>
</xsl:when>
<xsl:otherwise>
<li>
<a href="{concat($webrootLangW,@uri)}">
<xsl:value-of select="display-name" disable-output-escaping="yes"/>
</a>
</li>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="current()/collection or current()/item[not(starts-with(@uri,'index.'))]">
<ul>
<xsl:apply-templates select="current()/collection[display-order and display-order > 0 ]" mode="sitemap">
<xsl:sort select="display-order" order="ascending"/>
<xsl:with-param name="level" select="($level + 1)"/>
</xsl:apply-templates>
<xsl:apply-templates select="current()/item[display-order and display-order > 0 and not(starts-with(@uri,'index.')) ]" mode="sitemap">
<xsl:sort select="display-order" order="ascending"/>
<xsl:with-param name="level" select="($level + 1)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
{code}
2. Create a new collection for example named "sitemap"
3. Add .configxml with the following content to your collection ("sitemap":
{code}
<?xml version="1.0"?>
<bxcms xmlns="http://bitflux.org/config">
<plugins>
<parameter name="xslt" type="pipeline" value="sitemap.xsl"/>
<plugin type="sitemap"/>
<plugin type="navitree"/>
</plugins>
</bxcms>
{code}
With the Sitemap-Plugin you can easy add a Sitemap to your website.
Howto?
1. Create a xsl-file "sitemap.xsl" with the following content:
{code}
<?xml version="1.0" encoding="utf8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xhtml">
<xsl:include href="master.xsl"/>
<xsl:variable name="sitemapPlugin" select="/bx/plugin[@name='sitemap']"/>
<xsl:template name="content">
<h1>Sitemap</h1>
<xsl:apply-templates select="$sitemapPlugin/sitemap/collection[display-order and display-order > 0]" mode="sitemap">
<xsl:sort select="display-order" order="ascending"/>
<xsl:with-param name="level" select="'1'"/>
</xsl:apply-templates>
<!-- <xsl:apply-templates select="$sitemapPlugin/sitemap/collection[not(display-order) and not(@uri='/intro/')]" mode="sitemap">
<xsl:with-param name="level" select="'1'"/>
</xsl:apply-templates>
-->
</xsl:template>
<xsl:template match="item" mode="sitemap">
<xsl:variable name="postfix" select="concat('.',$lang,'.xhtml')"/>
<xsl:if test="contains(@uri,$postfix)">
<li>
<a href="{concat($webrootLangW,../@uri,substring-before(@uri,$postfix),'.html')}">
<xsl:value-of select="display-name" disable-output-escaping="yes"/>
</a>
</li>
</xsl:if>
</xsl:template>
<xsl:template match="collection" mode="sitemap">
<xsl:param name="level" select="level"/>
<xsl:choose>
<xsl:when test="$level = 1">
<h3>
<a href="{concat($webrootLangW,@uri)}">
<xsl:value-of select="display-name" disable-output-escaping="yes"/>
</a>
</h3>
</xsl:when>
<xsl:otherwise>
<li>
<a href="{concat($webrootLangW,@uri)}">
<xsl:value-of select="display-name" disable-output-escaping="yes"/>
</a>
</li>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="current()/collection or current()/item[not(starts-with(@uri,'index.'))]">
<ul>
<xsl:apply-templates select="current()/collection[display-order and display-order > 0 ]" mode="sitemap">
<xsl:sort select="display-order" order="ascending"/>
<xsl:with-param name="level" select="($level + 1)"/>
</xsl:apply-templates>
<xsl:apply-templates select="current()/item[display-order and display-order > 0 and not(starts-with(@uri,'index.')) ]" mode="sitemap">
<xsl:sort select="display-order" order="ascending"/>
<xsl:with-param name="level" select="($level + 1)"/>
</xsl:apply-templates>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
{code}
2. Create a new collection for example named "sitemap"
3. Add .configxml with the following content to your collection ("sitemap":
{code}
<?xml version="1.0"?>
<bxcms xmlns="http://bitflux.org/config">
<plugins>
<parameter name="xslt" type="pipeline" value="sitemap.xsl"/>
<plugin type="sitemap"/>
<plugin type="navitree"/>
</plugins>
</bxcms>
{code}