hreflang
The rel="alternate" hreflang="x"
link attribute is an HTML meta element and is also called a hreflang comment. The use of this ensures that the search engines understand the respective geographic orientation of a website and deliver the appropriate language version or regional URL of a website to the user.
Example cases for the application
- 1. Identical or almost identical content on a website
- A website offers the content in several regions with the same language (e.g. USA and Great Britain). The content can then be identical or almost identical ( duplicate content ), as often only small variations such as the regional spelling or the contact information are different.
- 2. Only the website template has been translated
- For websites that mainly offer user-generated / dynamic content, only the template or the navigation bars and footers have been translated. The main content is only available in one language.
- 3. The text of the website has been fully translated but the content is the same
- The respective pages are in different languages, e.g. B. French and English.
- 4. The website offers all visitors a main page. Exception for visitors with a certain language and / or country affiliation
- The website has only translated sections and / or would like to offer this content only to users in a certain language and region. All unspecified users are taken to the main page.
use
There are three ways to implement the hreflang annotation:
- HTML link element in the header
- Add a link element in the HTML header that refers to the other language version.
- HTTP headers
- The HTTP header can be used for files that are not saved in HTML format but, for example, as PDF.
- Sitemap
- The information is submitted via a sitemap.
Special features when using
When using the hreflang annotation, the bidirectional linking (backward relationship) should be taken into account. This means that all equivalent content must be linked to one another. This is the only way for the search engine to understand the website's network architecture. If the hreflang comment is only set “in one direction”, the structure is broken and not valid from the point of view of search engines.
- Example:
Both side A refers to side B and side B to side A. Logically, both are a useful target of the other.
A language or a combination of a language and a region (country) are allowed as values. The sole use of a region or country is not permitted.
General structure of the HTML link element
- The general structure is as follows:
<link rel=”alternate” hreflang=”xx-XX” href=”URL” />
Explanation
- <link ← Open link element
- rel = ”alternate” ← Indicates an alternative version of this document
- hreflang = ”xx-XX” ← Specifies the language (xx) and the region (XX) of the document
- href = ”URL” ← Contains the absolute URL of the further document in another language
- /> ← Closed link element