Mobile app version of vmapp.org
Login or Join
Lee4591628

: Indexing a multilingual website I am trying to create a multilingual website using the Django framework, all default content is English. I have added a native translation (Dutch). https://mydomain.com/

@Lee4591628

Posted in: #Django #Google #Indexing #Multilingual #Seo

I am trying to create a multilingual website using the Django framework, all default content is English. I have added a native translation (Dutch).
mydomain.com/ redirects to the user request language setting. (This is default behaviour by adding Django's LocaleMiddleware)


LocaleMiddleware tries to determine the user's language preference by
following this algorithm:

First, it looks for the language prefix in the requested URL. This is
only performed when you are using the i18n_patterns function in your
root URLconf. See Internationalization: in URL patterns for more
information about the language prefix and how to internationalize URL
patterns.

Failing that, it looks for a django_language key in the current user's
session.

Failing that, it looks for a cookie.

The name of the cookie used is set by the LANGUAGE_COOKIE_NAME
setting. (The default name is django_language.)

Failing that, it looks at the Accept-Language HTTP header. This header
is sent by your browser and tells the server which language(s) you
prefer, in order by priority. Django tries each language in the header
until it finds one with available translations.

Failing that, it uses the global LANGUAGE_CODE setting.


So visiting '/' will result to either:
mydomain.com/en/ or mydomain.com/nl/
Title, description, keywords and content are language based so every page is (almost) entirely translated. So:
mydomain.com/en/my-awesome-page/
has a Dutch flag (language switch) that holds this link:
mydomain.com/nl/mijn-fantastische-pagina/
This works great. Also my page's header holds alternate content based upon the language variable, here's the pseudo code:

<html lang="{{ current_language }}" />
<head>
{% for lang_code in other_languages %}
<link rel="alternate" hreflang="{{ lang_code }}" href="{% url current_url language=lang_code %}"/>
{% endfor %}
</head>


This will result the english page to look like this:

<html lang="en" />
<head>
<link rel="alternate" hreflang="nl" href="https://mydomain.com/nl/mijn-fantastische-pagina/"/>
</head>


Now my problem is Google indexes my Homepage in english, while I want dutch visitors to see the dutch title and description in google's results (unless they look for the english translation).

I believe the problem might be due to auto redirecting the root url ('/') or automatically setting the language, should I exclude robots somehow? I have read this article but I haven't figured out the problem:
googlewebmastercentral.blogspot.nl/2010/03/working-with-multilingual-websites.html
Also if I add a site map to a multilingual site, would it be better to add a different sitemap for each language, or make one large tree based on language roots?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lee4591628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Samaraweera270

I believe the problem might be due to auto redirecting the root url ('/') or automatically setting the language, should I exclude robots somehow?


Correct. Googlebot et al don't send an Accept-Language header, or accept cookies, so it'll see whatever the site defaults to without it, which would appear to be English in this case. You can verify this using Fetch as Googlebot in Webmaster Tools.

You could exclude robots, but then your site wouldn't get indexed at all, which rather throws out the baby with the bathwater. The best advice is don't automatically redirect based on perceived language of your users. Personally, I extend that to perceived location, too. Google offer the same advice.

Let your users decide what language and localisation settings are right for them, and allow that choice to persist via a cookie.


Also if I add a site map to a multilingual site, would it be better to add a different sitemap for each language, or make one large tree based on language roots?


Wouldn't make a difference, assuming usual size limitations are respected, although splitting them out by language might be easier in the sense that it's a logical separation that might make your life easier.

You should probably also consider using Google's alternate/hreflang Sitemap, which is intended specifically for instances where there are multiple language versions/variants of a site.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme