Copied to clipboard

Flag this post as spam?

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


  • Faris 2 posts 82 karma points
    Aug 28, 2019 @ 10:38
    Faris
    0

    Sitemap shown on every route

    Hi guys,

    so I have this issue with Sitemap which by conventions should be shown only on https://domain.com/sitemap, which I'm trying to achieve, but however it can be accessed from every URI like https://domain.com/route1/route2/sitemap

    Has anyone ever came across this issue, since I cant find anything about it?

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Aug 29, 2019 @ 11:27
    Shaishav Karnani from digitallymedia.com
    101

    Hi Faris,

    You must have a template name sitemap.

    By default, alternate template is true causing templates to appear after every actual url. You can disable this feature.

    Below is the link on how this can be managed in config/umbracosettings.config. https://our.umbraco.com/documentation/reference/config/umbracosettings/

    disableAlternativeTemplates="false" will fix the issue.

    <web.routing
        trySkipIisCustomErrors="false"
        internalRedirectPreservesTemplate="true"
        disableAlternativeTemplates="false"
    />
    
  • Faris 2 posts 82 karma points
    Aug 30, 2019 @ 08:26
    Faris
    0

    I'm having this weird behaviour now.

    I opened umbracoSettings file and I saw that disableAlternativeTemplates was set to false. However when I set it to true, sitemap can be opened only on root of domain, but when I try to open https://domain.com/something/sitemap it renders "something" but route stays with /sitemap. Is there way to avoid this so only /something would stay.

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Aug 30, 2019 @ 09:12
    Shaishav Karnani from digitallymedia.com
    1

    Hi Faris,

    You are right here we have possibility of multiple url for same content. Also if you open in Preview Mode then you can access content via Node Id too.

    So, best is to use canonical tag on the page. This will ensure that you have same url for SEO purpose even though same content is viewed from multiple url.

    String Authority = Request.Url.GetLeftPart(UriPartial.Authority);
    String Canonical = Authority + Model.Url;
    if (!Canonical.EndsWith("/"))
    {
        Canonical = Canonical + "/";
    }
    <link rel="canonical" href="@Canonical" />
    

    Regards,

    Shaishav

Please Sign in or register to post replies

Write your reply to:

Draft