Given that the first part of the path would actually resolve to a node, you could ask the base/default contentfinder to get that for you. So make a loop where you remove segments on by one:
Now you have your base node. Then you trim that part of the url, from the inbound request url, leaving you with "2016/07/12/saa-koerer-det/". And then I guess you can find the actual node you want based on whatever logic you need?
Well, with the rewrite rule, you will have to know that the "calendar" node is never renamed/moved, or have some sort of uniquely identifiable way of knowing when to remove the date part of the url.
How to handle hostname with path step in a ContentFinder?
Hi,
I'm writing a
ContentFinder
for some calendar content that has URLs like this:The first one has its hostname set to domain.io while the second one is set to domain.io/da
What's the sensible way to get the path after the domain name, in the
ContentFinder
'sTryFindContent()
method?If I use the
Uri.GetAbsolutePathDecoded()
method, it's including the/da/
part that's part of the domain (Umbraco-wise, at least).Thanks,
/Chriztian
My approach would be something like this.
Given that the first part of the path would actually resolve to a node, you could ask the base/default contentfinder to get that for you. So make a loop where you remove segments on by one:
Now you have your base node. Then you trim that part of the url, from the inbound request url, leaving you with "2016/07/12/saa-koerer-det/". And then I guess you can find the actual node you want based on whatever logic you need?
Thanks Morten - that seems like a neat way of doing it.
(And of course - now I'm suddenly thinking that what I'm actually going to need, is a rewrite rule... :-)
I'll give this a shot, nevertheless - thanks!
/Chriztian
Well, with the rewrite rule, you will have to know that the "calendar" node is never renamed/moved, or have some sort of uniquely identifiable way of knowing when to remove the date part of the url.
You're right - very good point!
(Not that clients ever rename pages or — God forbid — move stuff around! 😱)
is working on a reply...
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.