Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm used to installing a Google sitemap.xml package on all our website, but now run into an issue i haven't seen before when i try to do this with Umbraco 4.5. my XSLT:
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library"><xsl:output method="html"/><xsl:param name="currentPage"/><xsl:variable name="maxLevelForSitemap" select="6"/><xsl:variable name="url" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))" /> <xsl:template match="/"><xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/><urlset xmlns="http://www.google.com/schemas/sitemap/0.84"> <url> <loc> <xsl:value-of select="$url"/> </loc> <lastmod> <xsl:value-of select="$currentPage/ancestor-or-self::node [@level=1]/@updateDate" />+00:00 </lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level=1]"/> </xsl:call-template></urlset></xsl:template><xsl:template name="drawNodes"> <xsl:param name="parent"/> <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"> <xsl:for-each select="$parent/node [string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]"> <url xmlns="http://www.google.com/schemas/sitemap/0.84"> <loc> <xsl:value-of select="$url"/><xsl:value-of select="umbraco.library:NiceUrl(@id)"/> </loc> <lastmod> <xsl:value-of select="@updateDate" />+00:00 </lastmod> <changefreq>Weekly</changefreq> <priority>0.5</priority> </url> <xsl:if test="count(./node [string(./data [@alias='umbracoNaviHide']) != '1' and @level <= $maxLevelForSitemap]) > 0"> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if> </xsl:for-each> </xsl:if></xsl:template></xsl:stylesheet>
My error:
Looks like this might work (I'm getting output), but it probably still needs some tuning:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><xsl:variable name="url" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))" /><xsl:variable name="maxLevelForSitemap" select="10"/><xsl:template match="/"><xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/><urlset xmlns="http://www.google.com/schemas/sitemap/0.84"> <url> <loc> <xsl:value-of select="$url"/> </loc><lastmod> <xsl:value-of select="$currentPage/ancestor-or-self::node [@level=1]/@updateDate" />+00:00 </lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url><xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* "/> </xsl:call-template></urlset></xsl:template><xsl:template name="drawNodes"><xsl:param name="parent"/> <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"><xsl:for-each select="$parent/* [string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap]"> <url xmlns="http://www.google.com/schemas/sitemap/0.84"> <loc><xsl:value-of select="$url"/><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></loc><lastmod><xsl:value-of select="@updateDate" />+00:00</lastmod> <changefreq>Weekly</changefreq> <priority>0.5</priority></url><xsl:if test="count(./* [string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap]) > 0"> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if> </xsl:for-each></xsl:if></xsl:template></xsl:stylesheet>
Is it 4.7 compatible? Is it possible to setup priority for a page?
You could set up a a page property to set the priority and output it in the xml, sure
I haven't used 4.7 for production websites yet, so don't know. I don't know think anything has changed regarding xslt though?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Getting googlesitemap to work with 4.5
I'm used to installing a Google sitemap.xml package on all our website, but now run into an issue i haven't seen before when i try to do this with Umbraco 4.5. my XSLT:
My error:
Looks like this might work (I'm getting output), but it probably still needs some tuning:
Is it 4.7 compatible? Is it possible to setup priority for a page?
You could set up a a page property to set the priority and output it in the xml, sure
I haven't used 4.7 for production websites yet, so don't know. I don't know think anything has changed regarding xslt though?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion