UrlSegmentProvider giving "This document is published but its url would collide with content" error
For a specific content type I want to generate a url that is made of also part of property of node.
Specifically I want a blog post to be /archive/yyyy/mm/dd/title instead of the default url /archive/title.
I did it a while ago, on Umbraco 7.3, and to achieve this I made custom UrlSegmentProvider that was returning a new segment yyyy/mm/dd/title (basically adding 3 new segments).
Now I migrated to 7.5 and when I publish a post I get the following test as Link to Document: This document is published but its url would collide with content (unknown).
The url is not colliding with anything in the site at the moment. Also visible from the (unknown) instead of the node id it collides to.
Is this a bug introduced in Umbraco? Or a UrlSegmentProvider should not add "segments"?
A url segment provider should not add segments, just provide a single segment. For what you are doing you need to write a UrlProvider which provides the entire url for a content item.
Like mentioned by the others, a urlProvider is what you really need (and a contentfinder to find it back).
And people will shoot me for this, but I still like the "date folders" concept for blogs when you need overview pages per year, month, ...
I know, this rules out the listview, but content editors know where to look for there articles without searching.
I know I can use the UrlProvider + ContentFinder.. actually I did it already... :)
The beauty of using the segment provider is that you didn't need to mess with Content Finders :)
@Damiaan... I know... for the big project I went that approach, but I needed to keep the same url for the migration of my blog, and since articulate puts everything under /archive/ I just needed to add the date in the url.
UrlSegmentProvider giving "This document is published but its url would collide with content" error
For a specific content type I want to generate a url that is made of also part of property of node.
Specifically I want a blog post to be
/archive/yyyy/mm/dd/title
instead of the default url/archive/title
.I did it a while ago, on Umbraco 7.3, and to achieve this I made custom UrlSegmentProvider that was returning a new segment
yyyy/mm/dd/title
(basically adding 3 new segments).Now I migrated to 7.5 and when I publish a post I get the following test as Link to Document:
This document is published but its url would collide with content (unknown)
.The url is not colliding with anything in the site at the moment. Also visible from the
(unknown)
instead of the node id it collides to.Is this a bug introduced in Umbraco? Or a UrlSegmentProvider should not add "segments"?
A url segment provider should not add segments, just provide a single segment. For what you are doing you need to write a
UrlProvider
which provides the entire url for a content item.Thx. Maybe there should be a different way a giving the error.
(unknown)
is kind of confusing.Maybe checking the string returned from the
GetUrlSegment
method and verify if it contains/
and raise exception somewhere.I think the point where the check should happen is in the
Umbraco.Core.Strings.ContentBaseExtensions.GetUrlSegment
method.This blog will probably help: http://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/
Jeroen
Hi, I was trying your code, but it doesn't handle requests for absolute urls.
Is there a way to just add the simple yyyy/mm/dd without rewriting the full urlprovider that handles all possible modes (absolute, relative, auto)?
Like mentioned by the others, a urlProvider is what you really need (and a contentfinder to find it back).
And people will shoot me for this, but I still like the "date folders" concept for blogs when you need overview pages per year, month, ... I know, this rules out the listview, but content editors know where to look for there articles without searching.
I know I can use the UrlProvider + ContentFinder.. actually I did it already... :)
The beauty of using the segment provider is that you didn't need to mess with Content Finders :)
@Damiaan... I know... for the big project I went that approach, but I needed to keep the same url for the migration of my blog, and since articulate puts everything under
/archive/
I just needed to add the date in the url.@Stephen I got the same error since upgrading from 7.5.6 to 7.5.13 and I am using a custom UrlProvider that wasn't triggering this message before.
Update: There is now issue tracker: http://issues.umbraco.org/issue/U4-9442#tab=Comments
If you're getting the "url would collide with content" error you could try the Url Preview package: https://our.umbraco.org/projects/backoffice-extensions/url-preview/
It will show the URLs instead of the error.
Jeroen
is working on a reply...