Hi.
I have a question regardin how umbraco handle request.
i have a localized site where the countries route are like mysite.com/fr/en/ (france) , mysite.com/de/de/ (germany, german) , mysite.com/de/en/ (germany, english) and so on.
My question is, the "/de/de" or "/fr/en" is the route for the country, but this is not a fisical route how unbraco deal with this request and find the corret node? There is some method that i can apply the url request and get the node id directly ?
Umbraco has a 'request' pipeline, containing a series of 'Content Finders' executed in order one after another, until content is found in Umbraco that matches the pattern of the incoming url.
You can create your own 'Content Finder' by creating a class that inherits IContentFinder, and implementing the 'TryFindContent' method, using the ContentFinderResolver at ApplicationStarting to add your Content Finder to the queue of Content Finders that ship by default.
That said.... you may be able to achieve the pattern you are after by using the structure of your site, eg if in the root of your Umbraco site you have a top level 'Country' node, and then beneath that, multiple 'Language' nodes, (if you add the umbracoUrlName property to the language document type, you can set the portion of the url corresponding to them as the shorter language letter code).
eg
and you can set the Url for the 'Country' via the Culture and Hostnames option:
but if you have a more complex scenario, eg when there is only one language in the country you don't have this pattern, or if sometimes there aren't actual pages for the content, but you want the url to fallback to the native language, then a custom IContentFinder is probably the way to go...
Hi Marc.
Thanks.
I' actually trying to build some endpoint where the raw ur like (myapi/getidfrolanguage/fr/en") l is give me content id of the node france/english
Localization Route and Node id
Hi. I have a question regardin how umbraco handle request. i have a localized site where the countries route are like mysite.com/fr/en/ (france) , mysite.com/de/de/ (germany, german) , mysite.com/de/en/ (germany, english) and so on. My question is, the "/de/de" or "/fr/en" is the route for the country, but this is not a fisical route how unbraco deal with this request and find the corret node? There is some method that i can apply the url request and get the node id directly ?
Thanks.
Hi Anderson
Umbraco has a 'request' pipeline, containing a series of 'Content Finders' executed in order one after another, until content is found in Umbraco that matches the pattern of the incoming url.
You can create your own 'Content Finder' by creating a class that inherits IContentFinder, and implementing the 'TryFindContent' method, using the ContentFinderResolver at ApplicationStarting to add your Content Finder to the queue of Content Finders that ship by default.
see: https://our.umbraco.com/documentation/reference/routing/request-pipeline/IContentFinder
That said.... you may be able to achieve the pattern you are after by using the structure of your site, eg if in the root of your Umbraco site you have a top level 'Country' node, and then beneath that, multiple 'Language' nodes, (if you add the umbracoUrlName property to the language document type, you can set the portion of the url corresponding to them as the shorter language letter code).
eg
and you can set the Url for the 'Country' via the Culture and Hostnames option:
but if you have a more complex scenario, eg when there is only one language in the country you don't have this pattern, or if sometimes there aren't actual pages for the content, but you want the url to fallback to the native language, then a custom IContentFinder is probably the way to go...
Hi Marc. Thanks. I' actually trying to build some endpoint where the raw ur like (myapi/getidfrolanguage/fr/en") l is give me content id of the node france/english
is working on a reply...