Copied to clipboard

Flag this post as spam?

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


  • Bobi 280 posts 743 karma points
    Mar 02, 2020 @ 03:00
    Bobi
    0

    umbracoUrlName how to rename full url path

    I would like to rename the full url path, so that there are not multiple pages showing the same content (for SEO reasons).

    The navigation has a HOME node and a child node called TEST. TEST has a child node called TESTABC. Right now the url to get to TESTABC is /test/testabc. I want it to just be /testabc and I do not want /test/testabc to work.

    I have tried umbracoUrlName. I am unsure whether using another property alias would assist without effecting SEO (https://our.umbraco.com/documentation/Reference/Routing/routing-properties).

    Any ideas on how to effectively and efficiently do this?

  • Marc Goodson 1427 posts 9580 karma points MVP 5x c-trib
    Mar 02, 2020 @ 07:08
    Marc Goodson
    100

    Hi Bobi

    umbracoUrlName will only allow the editor to change the 'slug' of the page, so if your TESTABC node has an umbracoUrlName property and you updated it to be 'MySuperABC' then the Url will change to become /TEST/MYSuperABC... which isn't what you are after...

    The other routing property that can help here is umbracoUrlAlias, if you use this on you TESTABC page, then you can set a full relative new Url for the page, so if you add umbracoUrlAlias and updated it to be '/MySuperABC' then the url for your page will become /MySuperABC, however this does not by default replace the existing url, and the page would still be available as /TEST/TESTABC ... and if you use Model.Url in the navigation to write out your links, it will prefer the /TEST/TESTABC option over the umbracoUrlAlias.

    Generally there are several options here... you might consider implementing a CanonicalUrl

    https://support.google.com/webmasters/answer/139066?hl=en

    this is just a meta tag in the header of the page, with your preferred Url for this content - then whatever Url the page is available on - google and other search engines will group together the 'google juice' under this canonical Url - meaning no penalty for serving the same content on different Urls...

    So that would allow you to use umbracoUrlAlias, as the low tech method for customising your urls...

    However the way Urls are constructed, is completely pluggable, so you could create your own CustomUrlProvider, containing your logic for how Urls should be constructed, based on properties and types of pages, and replace the DefaultUrlProvider:

    https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#defaulturlprovider

    Or you could also look at this package:

    https://our.umbraco.com/packages/website-utilities/virtual-nodes-for-umbraco-8/

    which is using a CustomUrlProvider to ignore certain Umbraco nodes in the content tree from taking part in the Url, so in your example your TEST page could be a 'virtual' node and then the url would be /TESTABC

    (but either way you probably want a Canonical Url!)

    regards

    Marc

  • Bobi 280 posts 743 karma points
    Mar 03, 2020 @ 03:14
    Bobi
    0

    Thank you Marc for such a detailed response. Would you recommend using a package or building a CustomUrlProvider? If building the CustomUrlProvider, any recommendation on tutorials about how to do this?

    In regard to the canonical url, would this work too...<link rel="canonical" href="@Umbraco.NiceUrlWithDomain(CurrentPage.id)"> ?

  • Marc Goodson 1427 posts 9580 karma points MVP 5x c-trib
    Mar 03, 2020 @ 08:53
    Marc Goodson
    0

    Hi Bobi

    If you have 'organising' nodes that appear in the content tree, but you don't want to take part in the Url format, then that virtual nodes package is exactly what you need.

    If you have lots of custom logic surrounding how the Url should be constructed, then the custom UrlProvider + ContentFinder is the more flexible path to follow, there is an example in the docs: https://our.umbraco.com/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#example-1

    There is also a 'really good example' in the source for the Virtual Nodes package :-P

    https://github.com/christopherrobinson/Virtual-Nodes-for-Umbraco-8/blob/master/VirtualNodes/VirtualNodesUrlProvider.cs

    Yes, the key thing for the canonical url is it should be the same for each variation of the page - only thought is if you use umbracoUrlAlias, you may want that version of the Url, to be the 'canonical one' if for example it contains powerful magic seo keywords... in which case you might want to check if a value is set for umbracoUrlAlias first, and then fallback to the Url of the page as the 'canonical' if it isn't...

    regards

    Marc

  • Bobi 280 posts 743 karma points
    Mar 03, 2020 @ 17:10
    Bobi
    0

    Thank you. I will check out that package. My only concern with that package is that the virtual node /TEST becomes unusable instead of being visible to users. The only reason that /TEST is the parent node of /TESTABC is for menu / nav purposes so that TESTABC can appear in the nav under /TEST but have a url as /TESTABC and not /TEST/TESTABC.

  • Marc Goodson 1427 posts 9580 karma points MVP 5x c-trib
    Mar 03, 2020 @ 18:37
    Marc Goodson
    0

    Hi Bobi

    Then, path of least resistance is to add a property with umbracoUrlAlias - implement a Canonical Url (that checks if umbracoUrlAlias is populated, before falling back to the Url), and also when writing out your navigation... check to see if an item has it's umbracoUrlAlias set, and use that instead of the .Url property, so people clicking on the nav go to the /TESTABC url directly from the nav...

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft