Copied to clipboard

Flag this post as spam?

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


  • yang 4 posts 84 karma points
    Aug 28, 2019 @ 04:13
    yang
    0

    Request url - load content

    In content tree, i have a page e.g news123 which is the name and its node id is '111'

    Umbraco generates a url when it's created and it would be like 'http://mydomain/news123' which is good and friendly.

    However, I notice umbraco can load content via a node ID, e.g. 'http://mydomain/111' and this is not readable. Is there a way to stop Umbraco loading content via node id in this case?

    I am quite new to Umbraco and any assistance would be appreciated.

    Cheers,

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Aug 28, 2019 @ 06:41
    Shaishav Karnani from digitallymedia.com
    100

    Hi,

    By default, Umbraco provides nodeid based url for Preview Mode. This is because it is possible that you have not published the page so no actual url but you still want to access the Unpublished page and you can do it using Preview button in the back-end.

    You need to set the canoncial url of the page to avoid any SEO issues.

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

    Hope that helps. Let me know for any other queries.

    Cheers,

    Shaishav

  • yang 4 posts 84 karma points
    Aug 29, 2019 @ 01:51
    yang
    0

    Thanks Shaishav.

    Actually, Canonical links have been added correctly for both node id url and friendly urls to avoid SEO issues.

    After a bit search, it is said node id urls are used for preview. So for now, i think it's ok to do Canonical links only.

Please Sign in or register to post replies

Write your reply to:

Draft