Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Emil Lindgren 22 posts 183 karma points
    Jul 08, 2019 @ 12:48
    Emil Lindgren

    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. enter image description here

    This is some of my code.

            IPublishedContent siteHomePage = Umbraco.TypedContentAtRoot().First();
        var newurl = siteHomePage.Next();
    }<urlset xmlns="" xmlns:xsi="" xsi:schemalocation="" xmlns:image="">@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";
          <lastmod>@(string.Format("{0:s}+00:00", node.UpdateDate))</lastmod>
  • Søren Kottal 441 posts 2735 karma points MVP c-trib
    Jul 08, 2019 @ 13:31
    Søren Kottal

    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 be Model.Site() (or just Model, if you only want to use it on the root node).

  • Emil Lindgren 22 posts 183 karma points
    Jul 09, 2019 @ 06:39
    Emil Lindgren

    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.

Please Sign in or register to post replies

Write your reply to: