Mobile app version of vmapp.org
Login or Join
Angela700

: Itemprop for canonical link and meta description in the head I've a problem with validation of the code provided by Google. Idea is (simplified): <head itemscope itemtype="http://schema.org/WebSite">

@Angela700

Posted in: #Html5 #Microdata #SchemaOrg #W3cValidation

I've a problem with validation of the code provided by Google. Idea is (simplified):

<head itemscope itemtype="http://schema.org/WebSite">
<title itemprop="name">Example.com - Best Website in the World</title>
<meta name="description" content="Blah Blah Blah" itemprop="description">
<link rel="canonical" href="https://example.com/" itemprop="url">
</head>


Inspired by Google documentation (see markup example).

The main problem is that the code above isn't valid:


Attribute itemprop not allowed on element meta at this point.
Attribute itemprop not allowed on element link at this point.


But if I remove itemprop, Google Structure Tool no longer recognizes the url and description as properties.

Please tell me why is that, I mean why does Google provide non-valid code and how can I solve this?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angela700

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

The example is invalid HTML+Microdata. It is not allowed to have the itemprop attribute on meta[name] or link[rel] elements.

The solution for HTML+Microdata would be to duplicate the elements:

<head itemscope itemtype="http://schema.org/WebSite">
<title itemprop="name">Example.com - Best Website in the World</title>
<meta name="description" content="Blah Blah Blah">
<meta itemprop="description" content="Blah Blah Blah">
<link rel="canonical" href="https://example.com/">
<link itemprop="url" href="https://example.com/">
</head>


With HTML+RDFa, it’s possible to mix:

<head typeof="schema:WebSite">
<title property="schema:name">Example.com - Best Website in the World</title>
<meta name="description" property="schema:description" content="Blah Blah Blah">
<link rel="canonical" property="schema:url" href="https://example.com/">
</head>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme