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

Try our conversational search powered by Generative AI!

Automatic language for internal page links


Can anybody here shed some light on the logic of "Language: Automatic (default)" in the link dialog in Episerver CMS? The default behavior in my 8.5 site seems to be that the language is selected based on the origin page.

I find this counterintuitive. I would expect the language to be adjusted according to the target page's available language.

To exemplify:

- current behavior when linking from EN page to SV page (language "automatic") results in 404

- wanted behavior would be that linking from EN page to SV page (where the former is only available in 1 language = Swedish) sends user to SV page without problems

Feb 11, 2016 14:35

I assume that it chooses the same target language as the current page you are on. 

If you are on a EN page, it will link to the EN version of the target page. 

Check out Fallback language to configure that content in another language can be used if the current page doesnt have a EN version for example. 

To let the links actually change to /SV if only a swedish version exist would cause trouble later on. You would suddenly end up in another site as user. 

Feb 11, 2016 14:55

If you don't configure fallback language then throwing a 404 seems logical. You can do this in edit mode under tools => LanguageSettings if you want fallback language...

Feb 11, 2016 14:59

And of course, if you want a link to actually switch to a different language version than you are currently on you would need to choose this language version explicitly in link dialog.

Hmm, for me :)

Feb 11, 2016 15:03

The reason I don't want to use fallback languages is because I don't want URLs with /en/page-in-Swedish (which is a content duplicate of /sv/page-in-Swedish).

I guess it's fine if the current behavior is what you describe, that the target language is the current page's language. But then "Automatic" is somewhat misleading and should rather be "Current language". Also, the fact that I could not find this documented anywhere (especially since "Automatic" is very ambigious) is frustrating.

Would you say this "Automatic" behavior could be changed programmatically? I.e. changing it from being based on origin language to being based on page target language?

Feb 11, 2016 15:14

Yeah, I don't like fallback languages either for the same reason. 

Of course you can change the behaviour (probably implement IContentLoader and inherit the current implementation is easiest). 

I wouldn't recommend it however. I see a world of pain :)

Feb 11, 2016 15:58


I'm pretty sure it's not based on the current page's language, but rather the preferred content language. That is, the language that's in the URL. So if user is trying to access page A in English, but it's only available in Swedish and fallback is English, then a link with automatic language selection on that page will still try to link to an English page.

You can render a canonical link in the head element, if you don't want search engines to pick up duplicate content. There's even an html helper (and web control) you can use which will take care of this for you.

I guess it's called automatic, since it's trying to link to the correct language for you. Otherwise it wouldn't work for pages with fallback languages, since they would link to the actual language and not the current preferred content language

Feb 11, 2016 19:04

True that.

Canonical links and also pointing out alternate language versions of the same content helps SEO. I normally skip the second unless I have SEO manager in the project which does it for me.

Feb 12, 2016 0:27
* 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.