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).

To be effective, it is important to note that hreflang attributes must be implemented in the source code of your source site. If using the Smartling Global Delivery Network, we will propagate these attributes into the code of your localized sites so you get their full SEO benefits. 

Visit Google Search Console Help, Yost, or Moz to learn more about the hreflang attribute.

Placement of hreflang Attributes

There are 3 common ways the hreflang attribute can be placed on your website:

  1. using link elements in the <head>
  2. using HTTP headers
  3. or using an XML sitemap

Only use one of the above locations.

Link elements in the <head>

You can optimize your localized sites for search engines by adding HTML <link> tags in the head 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="" />

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"


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.

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?