Nestet Microdata structure with Schema.org

雨燕双飞 提交于 2019-12-25 02:08:54

问题


Can you please tell me if this structure is correct?

<div itemscope="" itemtype="http://schema.org/WebPage">
   <div itemprop="creator">
      <div itemscope="" itemtype="http://schema.org/Article">
           <a itemprop="URL" itemprop="name"><a/>
      </div>
   </div>
</div>
  • Is this structure correctly nested?

  • Does itemprop="name" belong to itemtype="http://schema.org/Article"?

  • Can I use two or more itemprop in one element?


回答1:


  • itemprop="creator" must be on the same element as the itemscope.
  • itemprop="name" should not be specified on a. If you have it on a, the URL (in href) would be the name. As a solution, you could add a span (as child or as parent of a).
  • The property name is url, not URL.
  • Your closing a tag has to be </a>, not <a/>.
  • The creator property links to a Person or Organization, not an Article. So either you meant that, or you should use a different property. Maybe you mean about?

So this would give you:

<div itemscope itemtype="http://schema.org/WebPage">

  <div itemprop="creator" itemscope itemtype="http://schema.org/Person">
    <a itemprop="url"href="…"><span itemprop="name">…</span></a>
  </div>

  <!-- and/or -->

  <div itemprop="about" itemscope itemtype="http://schema.org/Article">
    <a itemprop="url" href="…"><span itemprop="name">…</span></a>
  </div>

</div>

Dose itemprop="name" belong to itemtype="http://schema.org/Article"?

Yes, always to its nearest parent itemscope.

Can I use two or more itemprop in one element?

No, you can’t add several itemprop attributes on the same element. But you can have several properties in one itemprop attribute.

However, make sure that all the properties expect the same value. This is not the case with Schema.org’s name (expects Text) and url (expects URL). If specified on a, the value will be the value of the href attribute, not the value of the a element.




回答2:


This line

<a itemprop="URL" itemprop="name"><a/><br />

should be

<a itemprop="URL" itemprop="name"></a>

Read Extending HTML5 — Microdata



来源:https://stackoverflow.com/questions/22283292/nestet-microdata-structure-with-schema-org

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!