Schema.org NewsArticle:徽标属性的值无效 [英] Schema.org NewsArticle: invalid value for logo property

查看:384
本文介绍了Schema.org NewsArticle:徽标属性的值无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在代码中标记一小段 NewsArticle ,但我无法验证它。



如果我这样做的话

 < div itemscope itemprop =publisheritemtype =https://schema.org /组织> 
< span itemprop =名称>我的公司< / span>
< / div>

验证器抱怨没有徽标



如果我添加徽标就像这样

 < div itemscope itemprop =publisheritemtype =https://schema.org/Organization> 
< span itemprop =名称>我的公司< / span>
< / div>

验证器抱怨该属性包含无效值。我在这里做错了什么?

解决方案

您的标记是有效的HTML5 + Microdata,您正在使用Schema.org词汇表。 使用验证程序,您可能会参考 Google的结构化数据测试工具。请注意,此工具中显示的错误并不一定意味着您的标记错误;它们通常意味着除非您提供某些属性,否则您将无法获得某些Google搜索结果功能。



如果您想在Google搜索中获得此搜索结果功能(例如,文章Rich Rich Snippet ),您必须为<$提供 ImageObject 项作为值(而不是URL值) c $ c> logo 属性。


$ b

 < div itemscope itemprop =publisheritemtype =http://schema.org/Organization> 

< div itemprop =logoitemscope itemtype =http://schema.org/ImageObject>
< img itemprop =urlsrc =https://www.mysite.de/resources/assets/71/small/my_logo_web.png/>
<! - - Google在这里可能需要更多的属性,例如高度和宽度 - >
< / div>

< span itemprop =name>我的公司< / span>

< / div>


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?

解决方案

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>

这篇关于Schema.org NewsArticle:徽标属性的值无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆