2

I have this snippet in a LocalBusiness listing (based on 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>  

But Google's structured data testing tool throws an error:

image
A value for the image field is required.

Why is it throwing the error?

Testing the URL directly: https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.wonderweddings.com%2Fweddingvenues%2F315%2Fbeachclub-sunrise

unor
  • 92,415
  • 26
  • 211
  • 360
Adam
  • 6,041
  • 36
  • 120
  • 208
  • And do you know why @type is of type Thing when I've defined that page as type LocalBusiness (see screenshot in post) or is that how it's supposed to work? – Adam Jul 04 '17 at 09:06

2 Answers2

3

The markup snippet you posted doesn’t give the quoted error. So your actual markup is probably doing things differently.

It seems that your image property isn’t nested under the LocalBusiness item:

  • Line 396: <div itemscope itemtype="http://schema.org/LocalBusiness">
  • Line 372: <div itemprop='image' itemscope itemtype='http://schema.org/ImageObject'>
  • No itemref involved.

So your LocalBusiness item really doesn’t have an image property. Instead, the image property seems to be specified without any parent item (= itemscope), which is invalid.

Google’s SDTT probably ignores this error and parses the ImageObject as a top-level item, which is why it’s listed on its own (next to LocalBusiness and BreadcrumbList).

How to fix this?

If you can’t move the elements to nest them (like in your example snippet), you could make use of Microdata’s itemref attribute:

<div itemscope itemtype="http://schema.org/LocalBusiness" itemref="business-image"></div>
<div itemprop='image' itemscope itemtype='http://schema.org/ImageObject' id="business-image"></div>
unor
  • 92,415
  • 26
  • 211
  • 360
  • Thanks, I'll try that. I was unfamiliar with the `itemref` feature. Is it sufficient to have `itemref` point to an HTML element that contains the parent element? So, have the `image` point to something like this `
    ...
    ` like so: `
    ...
    `?
    – Adam Jul 03 '17 at 19:43
  • 1
    @Flo: You have to use it the other way around (I edited my answer to include an example). And yes, you can specify the `id` on a `div` element not used for Microdata -- then all of the descendant `itemprop`s will be added to the `itemref`-ing item. – unor Jul 03 '17 at 20:19
  • Ah, thanks. And what if I wanted to reference multiple items? e.g. `Reviews`, `BreadcrumbList` etc etc? Could I just add multiple `itemref` attributes? – Adam Jul 03 '17 at 20:22
  • 1
    @Flo: One `itemref` attribute with a value consisting of multiple ID tokens, separated with whitespace (`itemref="a b c"`). [Links to specifications, examples etc. in this answer.](https://stackoverflow.com/a/33984412/1591669) – unor Jul 03 '17 at 20:40
0

Add in snippet

In LocalBusiness schema, Required image, PriceRange field

Properties from Thing - Google returns errors..

Error:

image=A value for the image field is required.

priceRange=The priceRange field is recommended. Please provide a value if available.

Ans: add in code

1.For (image,logo,photo)= Image Object or URL = An image of the item. This can be a URL or a fully described ImageObject.

  1. For priceRange = Text = The price range of the business, for example $$$.

That items mandatory in LocalBusiness

OpenWebWar
  • 580
  • 8
  • 16