On custom Url Provider, GetOtherUrls works but GetUrl won't
I'm having a puzzling issue with a custom URL provider. I'm trying to add the date to the URL of a blog post like so:
/company/blog/2020/08/12/post-name-here/
Everything I try in the GetUrl method simply results in a message "This document is published but its URL could not be routed", even if all I do is add some characters to the very end. I had my default culture hard-coded in the returned UrlInfo object. The weird part is, if I modify my code so it returns the same URL as the default, it works fine.
As soon as I move my code to GetOtherUrls, it works fine, but I want to change its primary URL.
I figured this is some kind of cache issue, but I reloaded the DB cache, un-/re-published the page, and restarted the site, and nothing helped.
I just looked at the source code here, and got a hint from that. It looks like Umbraco tries to confirm that the URL actually routes to some content before it will use it. I wasn't expecting that; I haven't set up the corresponding Content Finder yet. I guess I'll try that and see how it goes.
Once I set up a corresponding Content Finder, everything started working, so this seems to have been the issue: you need a working Content Finder to resolve your custom URL before Umbraco will use it. If Umbraco can't find content that corresponds to your URL, it will just show "This document is published but its URL could not be routed" on the node's Info tab.
On custom Url Provider, GetOtherUrls works but GetUrl won't
I'm having a puzzling issue with a custom URL provider. I'm trying to add the date to the URL of a blog post like so:
Everything I try in the GetUrl method simply results in a message "This document is published but its URL could not be routed", even if all I do is add some characters to the very end. I had my default culture hard-coded in the returned UrlInfo object. The weird part is, if I modify my code so it returns the same URL as the default, it works fine.
As soon as I move my code to GetOtherUrls, it works fine, but I want to change its primary URL.
I figured this is some kind of cache issue, but I reloaded the DB cache, un-/re-published the page, and restarted the site, and nothing helped.
Anyone have any ideas?
I just looked at the source code here, and got a hint from that. It looks like Umbraco tries to confirm that the URL actually routes to some content before it will use it. I wasn't expecting that; I haven't set up the corresponding Content Finder yet. I guess I'll try that and see how it goes.
Once I set up a corresponding Content Finder, everything started working, so this seems to have been the issue: you need a working Content Finder to resolve your custom URL before Umbraco will use it. If Umbraco can't find content that corresponds to your URL, it will just show "This document is published but its URL could not be routed" on the node's Info tab.
is working on a reply...