SDTT:"A value for the image field is required"

SDTT: "A value for the image field is required"

我在 LocalBusiness 列表中有这个片段(基于 this example):

<div itemscope itemtype="http://schema.org/LocalBusiness">
    <div itemprop="image" itemscope="" itemtype="http://schema.org/ImageObject">
        <img itemprop="contentUrl" src="/images/trouwlocatiefotos/medium/315_24_83_Veranda-005.jpg">
    </div>
</div>  

但是 Google's structured data testing tool 抛出错误:

image
A value for the image field is required.

为什么会抛出错误?

直接测试 URL:https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.wonderweddings.com%2Fweddingvenues%2F315%2Fbeachclub-sunrise

您发布的标记片段没有给出引用的错误。所以你的实际标记可能会以不同的方式做事。

您的 image 属性 似乎没有嵌套在 LocalBusiness 项下:

  • 第 396 行:<div itemscope itemtype="http://schema.org/LocalBusiness">
  • 第 372 行:<div itemprop='image' itemscope itemtype='http://schema.org/ImageObject'>
  • 不涉及 itemref

所以你的 LocalBusiness 项目确实没有 image 属性。相反,image 属性 似乎没有指定任何父项 (= itemscope),这是无效的。

Google 的 SDTT 可能会忽略此错误并将 ImageObject 解析为顶级项目,这就是它单独列出的原因(在 LocalBusiness 和 [ 旁边=23=]).

如何解决这个问题?

如果您不能移动元素来嵌套它们(就像在您的示例片段中一样),您可以使用 Microdata 的 itemref 属性:

<div itemscope itemtype="http://schema.org/LocalBusiness" itemref="business-image"></div>
<div itemprop='image' itemscope itemtype='http://schema.org/ImageObject' id="business-image"></div>

添加代码段

在 LocalBusiness 架构中,必需图像,PriceRange 字段

事物的属性 - Google returns 错误..

错误:

image=需要图像字段的值。

priceRange=推荐使用priceRange字段。如果可用,请提供一个值。

答案:在代码中添加

1.For(图像、徽标、照片)= 图像对象或 URL = 项目的图像。这可以是 URL 或完整描述的 ImageObject。

  1. For priceRange = Text = 商家的价格范围,例如$$$。

LocalBusiness 中的必填项