html – What is the hreflang attribute for?


I'm interested in SEO techniques and among my searches I found the hreflang attribute. Some examples:

<!-- Dentro do HEAD -->
<link hreflang="pt-br" href="...">

<!-- Dentro do BODY -->
<a hreflang="pt-br" href="...">...</a>

For a site that only has one language, is it necessary to include this tag?


The idea of ​​this attribute is to indicate the language of the anchor link where the attribute is. This is useful in terms of SEO for the search engine to better organize content.

This attribute is often used in conjunction with rel="alternate" to indicate that the link points to the same content, but in another language.

In case of a site with only one language it is not necessary, then it is enough to have <html lang="pt-BR"> in the HTML tag, to indicate which language the site is in (although nowadays search engines have no problem detecting the language from the site text).

Scroll to Top