Copied to clipboard

Flag this post as spam?

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


  • Martin Rud 103 posts 295 karma points
    Dec 12, 2020 @ 22:04
    Martin Rud
    0

    How to have urls with date structure for news in listview

    I would like my news structured as subnodes to the /news/ node and the urls to be like this:

    /news/2020/12/03/name-of-news-node
    

    This post suggests that I autofill an umbracoUrlAlias property with the desired url and that works fine (have tested it by filling it out manually).

    But with the use of umbracoUrlAlias the node still answers on its original url and I therefore get duplicate content:

    /news/2020/12/03/name-of-news-node
    /news/name-of-news-node
    

    I have tried with property umbracoUrlName instead, but slashes are replaced with dashes:

    /news-2020-12-03-name-of-news-node
    

    In the umbracoUrlAlias case I could either setup automatic 301 redirect or make use of canonical tags, but I would like to hear if anyone inhere has a better solution without that kind of hacks?

  • Martin Rud 103 posts 295 karma points
    Dec 12, 2020 @ 22:20
    Martin Rud
    0

    Aaron Sadler pointed me in this direction (from Facebook post): https://rickbutterfield.com/blog/umbraco-url-rewriting-part-2

    I will try that.

  • Marc Goodson 1451 posts 9716 karma points MVP 5x c-trib
    Dec 13, 2020 @ 21:04
    Marc Goodson
    0

    Hi Martin

    You could also implement a 'canonical url' in the metadata of the page:

    https://developers.google.com/search/docs/advanced/crawling/consolidate-duplicate-urls

    setting it to be the umbracoUrlAlias generated Url if it's filled in.

    Then the duplication of the Urls arriving at the same content wouldn't cause an issue from an SEO point of view...

    regards

    Marc

  • Martin Rud 103 posts 295 karma points
    Dec 14, 2020 @ 07:25
    Martin Rud
    0

    Hi Marc,

    Yes, that is right, but I would like a more "clean" solution so also the users won´t have to deal with the risk of seeing multiple urls for the same content. That could be confusing to them.

    But I have had some suggestions on how to solve it in the post in the Facebook group Umbraco Web Developers that I will now look into.

  • David Brendel 786 posts 2949 karma points c-trib
    Dec 14, 2020 @ 09:05
    David Brendel
    0

    Hi Martin,

    the suggested solution in the blog post seems a bit too much for just url changes you want to achieve.

    I would suggest to have a look at custom UrlProvider and ContentFinder. That is typically the way I do url changes like adding date to news and similar.

    the first one generates the url for you and the second tries to match urls to your content nodes.

    These sample are for v7 but the general handling should be mostly the same.

    https://github.com/Mantus667/UmbracoUrlHandling/blob/master/src/UmbracoUrlHandling/UrlProvider/BlogPostUrlProvider.cs

    https://github.com/Mantus667/UmbracoUrlHandling/blob/master/src/UmbracoUrlHandling/ContentFinder/BlogPostContentFinder.cs

    Regards David

  • Martin Rud 103 posts 295 karma points
    Dec 16, 2020 @ 07:01
    Martin Rud
    0

    Thanks for the pointer. I will look into that too. I will post my finding when I am done (in a couple of week cause the task is on hold for now :) )

  • Martin Rud 103 posts 295 karma points
    Feb 16, 2021 @ 14:43
    Martin Rud
    0

    Better late than never.... 🙂 Thanks for your anawers.

    I have decided to go with a solution where I fill out the umbracoUrlAlias field on save.

    https://our.umbraco.com/forum/using-umbraco-and-getting-started/105103-how-to-get-node-url-in-context-of-contentservice (here my solution is and I ask for some other advice)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies