Hello, so i run into a problem, and hope some here can help me with it.
Im working with siteMap.
My siteMap works perfectly with 1 root node, but then my question come in.
How can i make so that same siteMap as global and take two or more root nodes ?
Look at picture.
This is some of my code.
IPublishedContent siteHomePage = Umbraco.TypedContentAtRoot().First();
var newurl = siteHomePage.Next();
}<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.google.com/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">@RenderSiteMapUrlEntry(siteHomePage)@RenderSiteMapUrlEntriesForChildren(siteHomePage)</urlset>
@helper RenderSiteMapUrlEntry(IPublishedContent node)
{
// we're passing 'true' as an additional parameter to GetPropertyValue to read the value from the parent nodes, so this setting could be set 'per section
var changeFreq = node.GetPropertyValue<string>("searchEngineChangeFrequency", true);
if (String.IsNullOrEmpty(changeFreq))
{
changeFreq = "monthly";
}
// with the relative priority, this is a per page setting, so we're not passing true
var priority = node.GetPropertyValue<string>("searchEngineRelativePriority");
if (String.IsNullOrEmpty(priority))
{
priority = "0.5";
}
<url>
<loc>@EnsureUrlStartsWithDomain(node.UrlWithDomain())</loc>
<lastmod>@(string.Format("{0:s}+00:00", node.UpdateDate))</lastmod>
<changefreq>@changeFreq</changefreq>
<priority>@priority</priority>
</url>
}
Sitemap as Global Node
Hello, so i run into a problem, and hope some here can help me with it.
Im working with siteMap.
My siteMap works perfectly with 1 root node, but then my question come in.
How can i make so that same siteMap as global and take two or more root nodes ?
Look at picture.
This is some of my code.
Hi Emil
Instead of having you sitemap as a node in the tree, you could go with just the template, and load that on your rootnodes.
Say your template alias is
Sitemap
you can use that as the template for a node by using the url{nodeUrl}/sitemap
.You would then need to change your
siteHomePage
in your template to beModel.Site()
(or just Model, if you only want to use it on the root node).Hello Sören, Thanks for the answer. So I'm not 100% with you here.
so what you mean is that, i should load siteMap Template instead of my home template ?
If you mean something else please elaborate.
is working on a reply...