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 fed the xml through blackpoint.dk conversion tool and had to clean up a bit but got this and it seems to work, if anyone needs it:
<?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::* [@isDoc][@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::* [@isDoc][@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/* [@isDoc][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> <!-- optional: changefreq | values: always, hourly, daily, weekly, monthly, yearly, never --> <changefreq> weekly </changefreq> <priority> 0.5 </priority> </url> <xsl:if test="count(./* [@isDoc][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>
Worked perfectly for me. Thanks!
I can't get it to save without errors.... I must be missing something. I think I have fixed the pasting errors (greater than, less than and other things this forum screws up).
Can somebody link to a text file I can copy into the site and try?
This is a great simple solution to get your sitemap done.
I needed to exclude nodes based on other criteria (other than just umbracoNaviHide), plus customise frequency based on doc type.
Here is a modified version of the 4.5 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')"/> <xsl:element name="urlset" xmlns="http://www.google.com/schemas/sitemap/0.84"> <xsl:call-template name="renderNode"> <xsl:with-param name="node" select="$url"/> <xsl:with-param name="lastmod" select="concat($currentPage/ancestor-or-self::* [@isDoc][@level=1]/@updateDate,'+00:00')"/> <xsl:with-param name="changefreq" select="'daily'"/> <xsl:with-param name="priority" select="'0.8'"/> </xsl:call-template> <xsl:call-template name="renderNodes"> <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]"/> </xsl:call-template> </xsl:element> </xsl:template><xsl:template name="renderNode"> <xsl:param name="node"/> <xsl:param name="lastmod"/> <xsl:param name="changefreq"/> <xsl:param name="priority"/> <xsl:element name = "url" xmlns="http://www.google.com/schemas/sitemap/0.84"> <xsl:element name = "loc"><xsl:value-of select="$node"/></xsl:element> <xsl:element name = "lastmod"><xsl:value-of select="$lastmod"/></xsl:element> <xsl:element name = "changefreq"><xsl:value-of select="$changefreq"/></xsl:element> <xsl:element name = "priority"><xsl:value-of select="$priority"/></xsl:element> </xsl:element></xsl:template> <xsl:template name="renderNodes"> <xsl:param name="parent"/><xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or(umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 andumbraco.library:IsLoggedOn() = 1)"> <xsl:apply-templates select="$parent/* [@isDoc][@level <= $maxLevelForSitemap]" /></xsl:if></xsl:template> <xsl:template match="*"> <xsl:call-template name="renderNode"> <xsl:with-param name="node"><xsl:value-of select="$url"/><xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:with-param> <xsl:with-param name="lastmod" select="concat(@updateDate,'+00:00')"/> <xsl:with-param name="changefreq" select="'weekly'"/> <xsl:with-param name="priority" select="'0.5'"/> </xsl:call-template> <xsl:if test="count(./* [@isDoc][string(./umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap]) > 0"> <xsl:call-template name="renderNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </xsl:if></xsl:template> <xsl:template match="*[umbracoNaviHide = 1]" /> </xsl:stylesheet>
Here is an example for excluding a node type and changing some of the values for a node type;
<xsl:template match="LandingPage"> <xsl:call-template name="renderNode"> <xsl:with-param name="node"><xsl:value-of select="$url"/><xsl:value-of select="substring(umbraco.library:NiceUrl(@id),13)"/></xsl:with-param> <xsl:with-param name="lastmod" select="concat(@updateDate,'+00:00')"/> <xsl:with-param name="changefreq" select="'daily'"/> <xsl:with-param name="priority" select="'0.9'"/> </xsl:call-template></xsl:template><-- Nodes of OtherPageType will be excluded from site map --><xsl:template match="OtherPageType" />
My Issue: I have created 2 host names for my site. The "Home" node has the http://www.default.com and http://default.com host name and there is a child node with http://sub.default.com with children of its own. When the sitemap is generated it created a url that looks like this... http://default.comhttp://sub.default.com/page.aspx
I used the XSLT provided in the 1st post and that worked out great except for throwing out those errors with the other host name.
I was hoping that someone with a little more technical expertise could help me out with revising the XSLT to support having multiple host names.
Thank you!
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
New schema for 4.5
I fed the xml through blackpoint.dk conversion tool and had to clean up a bit but got this and it seems to work, if anyone needs it:
Worked perfectly for me. Thanks!
I can't get it to save without errors.... I must be missing something. I think I have fixed the pasting errors (greater than, less than and other things this forum screws up).
Can somebody link to a text file I can copy into the site and try?
This is a great simple solution to get your sitemap done.
I needed to exclude nodes based on other criteria (other than just umbracoNaviHide), plus customise frequency based on doc type.
Here is a modified version of the 4.5 xslt
Here is an example for excluding a node type and changing some of the values for a node type;
My Issue: I have created 2 host names for my site. The "Home" node has the http://www.default.com and http://default.com host name and there is a child node with http://sub.default.com with children of its own. When the sitemap is generated it created a url that looks like this... http://default.comhttp://sub.default.com/page.aspx
I used the XSLT provided in the 1st post and that worked out great except for throwing out those errors with the other host name.
I was hoping that someone with a little more technical expertise could help me out with revising the XSLT to support having multiple host names.
Thank you!
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.