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?
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.
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.
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:
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:
I have tried with property umbracoUrlName instead, but slashes are replaced with dashes:
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?
Aaron Sadler pointed me in this direction (from Facebook post): https://rickbutterfield.com/blog/umbraco-url-rewriting-part-2
I will try that.
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
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.
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
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 :) )
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)
is working on a reply...