Canonical contains invalid HTML attributes
This means that the URL in question specifies a canonical element that contains the invalid HTML attributes hreflang, lang, media, or type.
Why is this important?
Canonical annotations are meant to help search engines determine what page is canonical when a set of duplicates exists. When properly implemented, search engines will only index the canonical URL.
Google's documentation specifies that rel="canonical" annotation is ignored when it contains the attributes hreflang, lang, media, or type. That is because these attributes indicate the existence of alternate versions of a page, which conflicts with the meaning of the canonical tag.
What does the Hint check?
The hint will trigger for any URL that specifies a canonical link element containing HTML attributes that will cause the canonical annotation to be ignored, specifically hreflang, lang, media, or type.
Examples that trigger this Hint:
Consider the URL: https://example.com/page-a
The Hint would trigger for this URL if the rel="canonical" tag contained the type attribute:
Another example is if the rel="canonical" tag contained hreflang attributes:
The Hint would also trigger for this URL if the canonical link element contained lang or media attributes in the same way.
How do you resolve this issue?
Consider whether your page is part of a set of duplicates or an alternate version of a page, optimized for a specific location, language, or device.
If your page is a duplicate, remove the invalid HTML attributes from your rel="canonical" element.
If your page is an alternate, remove the rel="canonical" element and use the appropriate HTML annotation.