Question

This code was suggested to me:

<a itemprop="url" href="…"><span itemprop="name">…</span></a>

But do you think this code is also correct?

<li class="menu-home" itemprop="url">
     <a href="http://example.com/" title="Home" itemprop="name">Home</a>
</li>
Was it helpful?

Solution

No, this is not correct. There are special parsing rules for a.

Currently you’d have these name-value pairs:

url: Home
name: http://any.com/

But, of course, it should be the other way around. So:

  • The url property needs to be specified on a.
  • The name property needs to be specified on something other than a.

You could use, for example:

<li itemprop="name">
  <a itemprop="url" href="http://any.com/">Home</a>
</li>

(See also my answer to a similar question on Webmasters.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top