Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Common url for all languages

Vote:
 

Hi.

I'm currently involved in a project where that requires the url for all languages to stay the same, e.g. the language segmen (for instance /en/) cannot be a part of the url. I've changed the order of language selection so that the epslanguage-cookie is prioritized before anything else. But still the url is updated to reflect the current language.

Is there any way to avoid this?

Regards, Bjørn Terje Svennes

#255808
May 31, 2021 10:25
Vote:
 

Hi,

You can also map the languange i episerverframework.config for a specific domain/url. Look at the mappings section and add language="en" for you default adress. This will ensure that you language is mapped to one specific adress you can also add other for instance map the .se domain to swedisdh and the .com to English

You can refer below thread for more info-

https://world.episerver.com/forum/legacy-forums/Episerver-7-CMS/Thread-Container/2013/5/How-to-remove-en-from-url/

#255809
May 31, 2021 10:38
Vote:
 

We only have one domain that should handle all languages. There is an option on the page for changing it.

#255810
May 31, 2021 10:39
Vote:
 

I think it's possible:

  1. Remove the default episerver content route. By default, content routing is registered with a pattern of {language}/{node}/{partial}/{action} with partial and action parameters being optional.
  2. Create your own route: /{node}/{partial}/{action} and create a route resolver using the cookie instead of the /language/ in the url. Make sure to cover the scenario where there is no cookie.

Hope it helps !

#255812
May 31, 2021 11:51
Vote:
 

Thank you, Guiliano. I will try to go down that path. There is a lot of "magic" happening within the DefaultContentRoute. Guess I still have to use the MapContentRoute-extension, but add my handling as a parameter.

#255814
May 31, 2021 12:22
Vote:
 

I've been trying to implement my own routing resolver (as suggested by Guiliano), but I believe that to make things work I need to use the MapContentRoute-extension. This extensions accepts a MapContentRouteParameters-param and this is where I should add my custom routing. The problem is that I'm having a hard time finding the class that actually routes the language. Any ideas?

#255873
Jun 01, 2021 7:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.