Google serve the correct language or regional URL


rel="alternate" hreflang="x"
Help Google serve the correct language or regional URL
Many websites serve users from around the world, with content that's translated, or targeted to users in a certain region. The rel="alternate" hreflang="x" annotations help Google serve the correct language or regional URL to searchers. More information about multi-regional and multilingual sites.
Some example scenarios where rel="alternate" hreflang="x" is recommended:
  • You translate only the template of your page, such as the navigation and footer, and keep the main content in a single language. This is common on pages that feature user-generated content, like a forum post.
  • Your pages have broadly similar content within a single language, but the content has small regional variations. For example, you might have English-language content targeted at readers in the US, GB, and Ireland.
  • Your site content is fully translated. For example, you have both German and English versions of each page.
Using rel="alternate" hreflang="x"
Imagine you have an English language page hosted at http://www.example.com/, with a Spanish alternative at http://es.example.com/. You can indicate to Google that the Spanish URL is the Spanish-language equivalent of the English page in one of three ways:
  • HTML link element in header. In the HTML <head> section of http://www.example.com/, add a link element pointing to the Spanish version of that webpage at http://es.example.com/, like this:
<link rel="alternate" hreflang="es" href="http://es.example.com/" />
  • HTTP header. If you publish non-HTML files (like PDFs), you can use an HTTP header to indicate a different language version of a URL:
Link: <http://es.example.com/>; rel="alternate"; hreflang="es"
  • Sitemap. Instead of using markup, you can submit language version information in a Sitemap.
If you have multiple language versions of a URL, each language page in the set must userel="alternate" hreflang="x" to identify all language versions including itself. For example, if your site provides content in French, English, and Spanish, the Spanish version must include arel="alternate" hreflang="x" link for itself in addition to links to the French and English versions. Similarly the English and French versions must each include the same references to the French, English, and Spanish versions.
If you have several alternate URLs targeted at users with the same language but in different locales, it's a good idea to provide a generic URL for geographically unspecified users. For example, you may have specific URLs for English speakers in Ireland (en-ie), Canada (en-ca), and Australia (en-au), but want all other English speakers to see your generic English (en) page, and everyone else to see the homepage. In this case you should specify the generic English-language (en) page for searchers in, say, the UK. You can annotate this cluster of pages using a Sitemap file or using HTML link tags like this:
<link rel=”alternate” href=”http://example.com/en-ie” hreflang=”en-ie” />
<link rel=”alternate” href=”http://example.com/en-ca” hreflang=”en-ca” />
<link rel=”alternate” href=”http://example.com/en-au” hreflang=”en-au” />
<link rel=”alternate” href=”http://example.com/en” hreflang=”en” />
For language/country selectors or auto-redirecting homepages, you should add an annotation for the hreflang value "x-default" as well:
<link rel=”alternate” href=”http://example.com/” hreflang=”x-default” />

0 Comments