Google updated their hreflang documentation to address a quirk in how some websites use it, which may lead to unintended consequences in Google's processing.
hreflang Link Tag Attributes
The <link>
HTML attribute communicates data to browsers and search engines about linked resources relevant to the webpage, such as CSS, JS, favicons, and hreflang data. The hreflang attribute specifies languages and should be placed in the <head>
section of the document.
Quirk in hreflang
Google observed unintended behavior when publishers combine multiple attributes in one link element. This prompted an update in their documentation to highlight this issue. The changelog states:
"Clarifying link tag attributes: Clarified in our hreflang documentation that link tags for denoting alternate versions of a page must not be combined in a single link tag."
Documentation Changes
The documentation now explicitly warns against combining link tags for alternate representations of a document. Below are the changes:
Old Version:
"Put your
<link>
tags near the top of the<head>
element. At minimum, the<link>
tags must be inside a well-formed<head>
section, or before any items that might cause the<head>
to be closed prematurely, such as<p>
or a tracking pixel. If in doubt, paste code from your rendered page into an HTML validator to ensure that the links are inside the<head>
element."
New Version:
"The
<link>
tags must be inside a well-formed<head>
section of the HTML. If in doubt, paste code from your rendered page into an HTML validator to ensure that the links are inside the<head>
element. Additionally, don’t combine link tags for alternate representations of the document; for example, don’t combine hreflang annotations with other attributes such as media in a single<link>
tag."
Implications
While Google did not specify the consequences of this quirk, it implies that combining attributes in a single link tag could cause issues, warranting attention from publishers and SEOs. For more details, refer to the newly updated documentation on Google's website.