The challenge is I cant have an additional node for 'en' or 'zh' in my content tree. So (I believe) the only option is to change the default route to indicate the 1st section of the url is language.
I tried to search how to change/re-configure the default route but no luck so far.
Any help is appreciated.
Thanks Jan for the quick reply.
I went through route hijacking, but its not useful in my case.
I dont want to add any custom Controller. All request still needs to be passed to/processed by default Controller.
{lang} attribute needs to be injected in all URLs across site. So its not possible to have a custom controller per document type. (If thats not the case then probably I can create a bunch of custom routes and it can solve my problem)
If you really want to have Urls in this structure then I think you will need to use a IContentFinder for this, however I don't think its a documented interface but there is a example in the Hybrid Framework here.
You will likely want to compliment the content finder with a url provider which is documented here Again there is a example in the Hybrid Framework here
Thanks Jeroen for useful articles.
Its still not exactly what I want to achieve; but nearly there. For a meanwhile I managed to control language selection by using cookies; so not changing URLs for language selection (just to limit the scope of my project).
How to change default route in Umbraco7
Hi,
I am setting up Umbraco for multi-language site under one domain. however I want to keep single tree only so I am using Vorto extension for multi-language.So far it looks good. However, my requirement is I want to have URL in this format: http://my.domain.com/<lang>/...
(e.g.,
http://my.domain.com/en/shop-locations/shop-in-sydney
http://my.domain.com/zh/shop-locations/shop-in-sydney
In both case, the request should go to the same content node.)
The challenge is I cant have an additional node for 'en' or 'zh' in my content tree. So (I believe) the only option is to change the default route to indicate the 1st section of the url is language.
I tried to search how to change/re-configure the default route but no luck so far. Any help is appreciated.
Thanks, Nirmit
Hi Nirmit
You can learn more about route hijacking here http://our.umbraco.org/documentation/Reference/Mvc/custom-controllers and here http://umbraco.com/follow-us/blog-archive/2014/1/27/a-practical-example-of-route-hijacking-in-umbraco
Hope this helps a bit.
/Jan
Thanks Jan for the quick reply. I went through route hijacking, but its not useful in my case.
Hope this will clarify my requirement further.
thanks.
If you really want to have Urls in this structure then I think you will need to use a IContentFinder for this, however I don't think its a documented interface but there is a example in the Hybrid Framework here.
You will likely want to compliment the content finder with a url provider which is documented here Again there is a example in the Hybrid Framework here
Good luck!
I found a little documention on IContentFinder here
I also wrote a blog about the UrlProvider and ContentFinder: http://24days.in/umbraco/2014/urlprovider-and-contentfinder/
Jeroen
Thanks Jeroen for useful articles. Its still not exactly what I want to achieve; but nearly there. For a meanwhile I managed to control language selection by using cookies; so not changing URLs for language selection (just to limit the scope of my project).
Thanks for your help.
Have someone resolved this issue?
I'm also struggling to put language into the URL and I don't want to put this in the cookie.
is working on a reply...