Schema.org NewsArticle: invalid value for logo pro

2019-01-12 09:56发布

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?

1条回答
对你真心纯属浪费
2楼-- · 2019-01-12 11:00

Your markup is valid HTML5+Microdata and you are using the Schema.org vocabulary appropriately.

With "validator", you probably refer to Google’s Structured Data Testing Tool. Note that errors shown in this tool don’t necessarily mean that your markup is wrong; they often mean that you won’t get a certain Google search result feature unless you provide certain properties.

If you want to get this search result feature in Google Search (e.g., the Article Rich Snippet), you have to provide an ImageObject item as value (instead of a URL value) for the logo property.

<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>
查看更多
登录 后发表回答