Hreflang

Hreflang is a feature in HTML that allows webmasters to specify the language of a link, using the “hreflang” attribute. This attribute is used to indicate the language of the linked page and can be useful for several purposes, such as:

  1. Internationalization: Hreflang can be used to indicate the language of a linked page, which can be useful for websites that are available in multiple languages. This allows users to navigate to the version of the page that is in their preferred language.
  2. SEO: Hreflang can also be used to help search engines understand the language of a linked page, which can improve the accuracy of search results.
  3. Accessibility: Hreflang can be used to provide a way for screen readers and other assistive technologies to announce the language of a linked page, which can be helpful for users who are visually impaired or have difficulty understanding written language.

The syntax for using hreflang is as follows:

<a href=”URL” hreflang=”language-code”>Link text</a>

Where “URL” is the URL of the linked page, “language-code” is a two-letter code that represents the language of the linked page, and “Link text” is the text that is displayed as the link.

For example:

<a href=”https://www.example.com/fr” hreflang=”fr”>Portail français</a>

This link would be displayed as “Portail français” and would link to the French version of the page at “https://www.example.com/fr”.

It’s important to note that the hreflang attribute should only be used for links that are accessible to all users and should not be used to create links that are only accessible to users who speak a certain language.