Google has recently revised its hreflang documentation to highlight a peculiar behavior observed in the usage of this attribute by certain websites. This anomaly may potentially result in unintended outcomes in how Google interprets and processes it.
hreflang Link Tag Attributes
The < link > attribute in HTML serves as a means to convey information to both browsers and search engines regarding linked resources pertinent to the webpage. It encompasses various types of data, including CSS, JS, favicons, and hreflang data.
Specifically concerning the hreflang attribute within the link element, its primary function is to designate languages. It’s worth noting that all link elements should be placed within the < head > section of the document.
Quirk In hreflang
Google identified an unintended behavior occurring when publishers merge multiple ‘hreflang’ attributes within a single ‘link’ element. Consequently, they have updated the hreflang documentation to raise broader awareness of this issue.
The changelog provides clarification:
“Clarifying link tag attributes
What: The hreflang documentation now explicitly states that link tags indicating alternate versions of a page should not be combined within a single link tag.
Why: In response to a site owner’s report, we observed this undocumented quirk during debugging.”
What Changed In The Documentation
The documentation has been revised to emphasize the importance of placing < link > tags within a properly structured < head > section of HTML. To verify compliance, users are advised to validate their rendered page using an HTML validator. Furthermore, it cautions against combining link tags for alternate document representations, such as hreflang annotations with other attributes like media, within a single < link > tag.
Although Google’s documentation doesn’t explicitly outline the consequences of this issue, its inclusion in their debugging process suggests it could lead to potential issues. Despite appearing minor, such nuances could yield significant impacts.
Original news from SearchEngineJournal