we have to solve a problem with Google not correctly indexing our multilanguage sites. We'll redesign our urls in the future but until then we need some way to help google find the different language versions while preserving convenience for the users, especially those that use already existing links.
First I'll explain our site/url structure a bit:
Assume we use the domain
foo.com. Our application will then detect the language of the browser and display either the english or the german version of the page. The user can then change the language by clicking a link which results in the query parameter
language=xx being appended.
The currently selected language is stored in the session, thus if the user doesn't change the language every page will be displayed in the language that was selected last.
Here's a short example for a user with browser language DE:
foo.com -> foo.com/bar -> foo.com/bar?language=en -> foo.com (German) (German) (English) (English now)
If the browser language is not supported or not provided, we assume English as a default.
So now, GoogleBot will have problems with this, since
foo.com could either return english or german content. Initially, GoogleBot should get the english version but if the language change link is followed (or the german TLD is used, since
foo.de redirects to
foo.com?language=de) the german version would be delivered).
Another problem is that our page internal links don't carry the language parameter. Although we could change that (with some effort in some cases) those links (without the parameter) are already present on external german sites and thus must be supported somehow.
To overcome this, we thought of the following redirection strategy:
foo.com -> no session yet: detect browser language -> if DE, then 302 to foo.com?language=de -> if EN, then deliver the english content -> we have session, so get the language from the session -> if DE, then 302 to foo.com?language=de -> if EN, then deliver the english content foo.com/bar -> the same as foo.com foo.de -> 301 to foo.com?language=de
Each page would then additionally have the
alternate relation set, e.g.
<link rel="alternate" hreflang="en" href="http://foo.com" /> <link rel="alternate" hreflang="de" href="http://foo.com?language=de" />
So, from our point of view, the following should happen:
- The user opens
foo.comand either gets the english version or is redirected to the version matching the browser language (if supported)
- The user clicks
foo.com/barand depending on the language in the session (or the browser language if the url is directly opened) either the english version is delivered or he's redirected to
- GoogleBot crawls
foo.comand since no language is provided it sees the english version, even when following the internal links
The real question here is:
As far as we know, there's no guarantee that GoogleBot either uses a session id or doesn't use it, thus we don't know whether there is a session being reused during crawling.
Thus there are two possibilities:
If GoogleBot uses a session, it might either get english content or a 302 redirect for any url that lacks the language parameter (e.g.
foo.com/bar). How would Google handle that?
If GoogleBot does not use a session it would get the german version for
foo.de, due to the redirect. If it then follows an internal link to
foo.com/barit should get the english content, since no language is provided and a new session is created. In that case, would GoogleBot store the alternate link
foo.com/bar?language=defor the german version?
Thanks so far to all who endured reading all that and even more so to all who have an answer to share.
Please note that we're working on redesigning our urls to always have the language in the path (e.g.
foo.com/en/bar) but that'll take a while and we also need to handle already existing links without the language. So please don't just suggest to restructure the urls.
As of request, here's the original problem that we're trying to tackle.
Our customer generally uses their .com domain and they want the result pages to display a German description when using google.de and an English description in any other case.
However, the results are always displayed in English.
Our current (seemingly insufficient) approach is this:
foo.com -> page in english or german, depending on the request language (and currently on the session as well) -> alternate link with hreflang=en : foo.com?language=en -> alternate link with hreflang=de : foo.com?language=de
We assumed that Google would be able to use the alternate language versions and display the best fitting version in a localized result page.
This, however, didn't work out so well yet and we assume one reason is that
foo.com itself isn't an alternate link to anything. Thus we thought about leaving the language parameter out for the english version (see the question above) and use
foo.com as the alternate link for hreflang=en.
We're no SEO experts though, so this could be wrong. If so please correct me with some hints or explanations. :)
With this trail of though we arrived at the point where
foo.com should represent the english version of the page only. However, if we change that, all german users (which are about 50% of the visitors) would first see the english page, because of the many links in the wild that don't contain any language parameter. And this is something our customer clearly doesn't want.
This again led us to the approach using redirects to
foo.com?language=xx and calculating
xx from the browser language (and the session as well, if it contains language information).