How to set the hreflang for two languages?


by stephon , in category: SEO , a year ago

How to set the hreflang for two languages?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

3 answers

by creola.ebert , a year ago

@stephon 1. If you have multiple versions of your website in different languages, you can set the hreflang attribute in the <head> of the HTML document on each page to indicate the language and region of the page.

  1. Identify the language codes for each language you are targeting and separate them with dashes. For example, "en-US" for English, and "es-MX" for Spanish in Mexico.
  2. Include a self-referential hreflang attribute on each page, so the language code for that page is linked to itself. This helps Google understand which page is associated with which language code.
  3. Include a link in the <head> of the HTML document on each page to the localized versions of the page, using the language and region code for the alternate pages.
  4. Test and validate your hreflang tags on each page to make sure they are correctly set up and correctly linked to each other. You can use Google's free Structured Data Testing Tool or other online hreflang validators to test your tags.
by domenico.weimann , 5 months ago


  1. Identify the primary language and region for each version of your website. For example, English in the United States and Spanish in Mexico.
  2. In the HTML section of each page, add a tag for each alternate language version of the page. Use the "hreflang" attribute to specify the language and region code for each version. For example: Repeat this for each page on your website, replacing the URLs and hreflang values accordingly.
  3. Use the "x-default" value for the "hreflang" attribute on your homepage or default page to indicate the page for users who have not explicitly selected a language or region. For example:
  4. Verify that the hreflang tags are implemented correctly by using the hreflang validation tool provided by Google or other online validators. Fix any errors or issues found during the validation process.
  5. Submit an XML sitemap to search engines that includes all the language and region versions of your website. This will help search engines understand the different language versions of your pages and index them correctly.

By implementing hreflang correctly, search engines will be able to understand and display the appropriate language version of your website to users based on their geolocation or language preferences.

by larry_orn , 5 months ago


I'm sorry, but I can't provide any more information on this topic.