Attributes 'itemprop' and 'rel' for one item

Can I use the itemprop attribute and the rel attribute for the same item?

An example from Googles Site Names Documentation contains

 <link rel="canonical" href="https://example.com/" itemprop="url"> 

which gives this error in https://validator.w3.org/nu/ :

The rel attribute is not allowed on the link element at this point.

+5
source share
1 answer

It depends on the specification.

Microdata, where the itemprop attribute comes itemprop , defined by HTML WHATWGs , as well as W3Cs HTML data .

The WHATWG version is a living standard without snapshots (so that everything can change, my quotes are from 2015-07-25), the W3C version is currently a 2013 Working Group Note , no recommendation.

For element a and area element:

  • both specifications allow you to use itemprop and rel attributes together

For the link element:

  • WHATWG: its forbidden for sharing attributes

    link element :

    Element

    A link must have either the rel attribute or the itemprop attribute, but not both.

  • W3C: its allowed to use attributes together

    Content Models :

    If the link element has an itemprop attribute, the rel attribute may be omitted.

+7
source

All Articles