0

I have a page example.com that includes a language file based on visitor's country (through IP). There is only one page but several language files.

Scenarios:

visitor in UK or any other country not supported by my languages -> example.com (language in English)

visitor from IT -> example.com (language in Italian)

The UK visitor changes the language to Italian -> example.com/it

The IT visitor changes the language to English -> example.com/en

The IT visitor who sees tha page in English, deletes the /en from the browser -> example.com (language in Italian)

HTML

I have set it like

<html lang="en">
<link rel="alternate" href="/it"  hreflang="it">

Questions

  1. Should I also add the "en" version, that means all the available languages?
  2. Is my structure the correct way of doing this?

Thank you

2
  • Do you mean that you load a language file like in a desktop application based on the visitors IP? Mar 13, 2015 at 13:10
  • @IgnacioSolerGarcia What I do is to identify the IP and include(en.php) depending on the country
    – EnexoOnoma
    Mar 13, 2015 at 14:37

1 Answer 1

1

Your structure is correct. For the 'all languages' version, you can use the hreflang="x-default" attribute for this.
This is explained more detailed by Googles hreflang article.

You could have the following elements:

 <html lang="en">
 <link rel="alternate" href="/it"  hreflang="it">
 <link rel="alternate" href="/"  hreflang="x-default"> <!-- or href="/en" -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.