World Library  
Flag as Inappropriate
Email this Article

Hreflang

Article Id: WHEBN0048131220
Reproduction Date:

Title: Hreflang  
Author: World Heritage Encyclopedia
Language: English
Subject: Search engine optimization, HTML
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Hreflang


The rel="alternate" hreflang="x" link attribute is a HTML meta element described in RFC 5988. Hreflang specifies the language and optional geographic restrictions for a document. Hreflang is interpreted by search engines and can be used by webmasters to clarify the lingual and geographical targeting of a website.

Contents

  • Purpose 1
  • Implementation 2
    • Language and Country Codes 2.1
    • Language Script Variations 2.2
    • X-Default 2.3
    • Common Mistakes 2.4
  • Markup Examples 3
    • HTML 3.1
    • HTTP 3.2
    • XML Sitemaps 3.3
  • References 4

Purpose

Many websites are targeted at audience with different languages and localized for different countries. This can cause a lot of duplicate content or near duplicate content, as well as targeting issues with users from search engines.

Search engines use hreflang to understand the lingual and geographical targeting of websites and use the information to show the right URL in search results, depending on user language and region preference.

There are 3 basic scenarios that can be covered with hreflang:

  • Same country, different languages
  • Different countries, different languages
  • Different countries, same language

Implementation

Hreflang can be implemented in 3 different ways.

The hreflang definition is done by creating a full set of all language and region specific versions of the same document. Every URL in the set must reference the full URL set. A self reference is required, so the including document has to be always part of the URL set.

Language and Country Codes

Hreflang accepts values that define languages ISO 639-1 and countries (ISO 3166-1). A language or a combination of language and region can be used as a value. A country-only value is not allowed.

Language Example
en
fr
be

Language and Region Example
en-CA
en-US
fr-CA

The hreflang value has to follow the standard in order to be used by search engines.

Language Script Variations

RFC 5646 allows language script variations as value for hreflang. Language script variations can directly be adressed using ISO 15924.

Examples
zh-Hant: Chinese (Traditional)
zh-Hans: Chinese (Simplified)

X-Default

x-default is a reserved hreflang value that can be used to specify a default version for a document. The x-default URL is not targeted at a specific region and/or language and is supposed to be shown to unspecified users. Google suggests to define an x-default version in each URL set, which will be shown to users from unspecified regions or languages in search results.[1][2]

The URL that is defined as the x-default for a certain document, can also be specified for a certain language or language and region at the same time.

Common Mistakes

Invalid hreflang usage can cause search engines to ignore the hreflang definitions for the entire website.

Common mistakes when using hreflang:[3]

  • using underscore instead of hyphen in language and country value
  • mixing up the order of the elements in language and country value
  • using country without language
  • using invalid language and country codes
  • URL set not complete
  • missing self reference
  • double usage of x-default with conflicting target URL
  • multiple conflicting hreflang definitions

Markup Examples

HTML











...

HTTP

HTTP/1.1 200 OK
Content-Type: application/pdf
Link: ; rel="alternate";hreflang="x-default", ; rel="alternate";hreflang="en-UK",
; rel="alternate";hreflang="en-US"
...

XML Sitemaps




    http://example.com/page.html
    
    
    


    http://us.example.com/page.html
    
    
    


    http://uk.example.com/page.html
    
    
    


...

References

  1. ^ "Use hreflang for language and regional URLs". Google Search Console Help. Retrieved 2015-10-08. 
  2. ^ "Introducing "x-default hreflang" for international landing pages". Google Webmaster Central Blog. Retrieved 2015-10-08. 
  3. ^ "Hreflang attribute for multilingual and multi-region sites". Audisto. Retrieved 2015-10-08. 
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.