4

I try to markup a little section in my code as NewsArticle but I can't get it to validate.

If I do this

<div itemscope itemprop="publisher" itemtype="https://schema.org/Organization">
  <span itemprop="name">My Company</span>
</div>

the validator complains that there is no logo.

And if I add a logo like this

<div itemscope itemprop="publisher" itemtype="https://schema.org/Organization">
  <img itemprop="logo" src="https://www.mysite.de/resources/assets/71/small/my_logo_web.png" />
  <span itemprop="name">My Company</span>
</div>

the validator complains that the attribute contains an invalid value. What am I doing wrong here?

4

1 回答 1

6

您的标记是有效的 HTML5+微数据,并且您正在适当地使用 Schema.org 词汇表。

对于“验证器”,您可能指的是Google 的结构化数据测试工具。请注意,此工具中显示的错误并不一定意味着您的标记是错误的;它们通常意味着除非您提供某些属性,否则您将无法获得某个 Google 搜索结果功能。

如果您想在 Google 搜索中获得此搜索结果功能(例如Article Rich Snippet),您必须提供一个ImageObject项目作为属性的值(而不是 URL 值)logo

<div itemscope itemprop="publisher" itemtype="http://schema.org/Organization">

  <div itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
    <img itemprop="url" src="https://www.mysite.de/resources/assets/71/small/my_logo_web.png" />
    <!-- and Google probably requires some more properties here, e.g. "height" and "width" -->
  </div>

  <span itemprop="name">My Company</span>

</div>
于 2016-03-21T16:21:59.147 回答