Search Engine Optimization

Implementing hreflang Attributes

The hreflang attribute allows you to show search engines what the relationship is between web pages in alternate languages. This becomes an important part of your SEO strategy when you offer websites in multiple languages to ensure you are not penalized for duplicate content, and so the search engine can serve relevant results to users searching in a given language (targeting).

Where to Place the hreflang Link Tag Block

The hreflang attribute can be placed in the on-page markup, the HTTP header, or the sitemap. Only use one of those locations.

On-page Markup

You can optimize your localized sites for search engines by adding HTML <link> tags in the header of your source pages, which will be duplicated on your localized pages automatically.

The hreflang attribute on each page should include a reference to itself (typically the english page), as well as to all the pages that serve as alternates for it:

<link rel="alternate" hreflang="en-us" href="" />
<link rel="alternate" hreflang="es-co" href="" />
<link rel="alternate" hreflang="es-us" href="" />


If you don't want to add the hreflang attribute to your on-page markup, you can provide this information to search engines via your sitemap. Google has a helpful guide to illustrate this process, or use this tool.

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: <>; rel="alternate"; hreflang="es"

To specify multiple hreflang values in a Link HTTP header, separate the values with commas like so:

Link: <>; rel="alternate"; hreflang="es",<>; rel="alternate"; hreflang="de"

Visit Google Search Console Help or Moz for additional help with the hreflang attribute.

The hreflang attribute is one aspect of international SEO. Learn more about SEO strategy for your localized sites in the Search Engine Optimization section of our Help Center.

Was this article helpful?