2

Can I use itemprop image directly?:

<article itemscope itemtype="http://schema.org/Article">
<img  itemprop="image" src="1.png">
<h1 itemprop="headline name" >Title of the post</h1>
<div>2016-01-07</div>           
<p itemprop="articleBody">This is the body of the post</p>
</article>

Or should I embed inside ImageObject?

<article itemscope itemtype="http://schema.org/Article">
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
    <img itemprop="contentUrl url" src="1.png" alt="alt of the image">
</div>
<h1 itemprop="headline name" >Title of the post</h1>
<div>2016-01-07</div>           
<p itemprop="articleBody">This is the body of the post</p>
</article>

When I use the Google tool (www.google.com/webmasters/markup-helper/) it gives me the first option.

But then the testing tool gives me an error:

The attribute image.itemtype has an invalid value

1 Answer 1

2

From the perspective of Schema.org, both ways are fine, as the image property expects an ImageObject value (your second example) or a URL value (your first example).

As always, a specific consumer might support only one of these two ways.

For many of Google’s rich results, an ImageObject is required, because Google wants to see more data about the image, which is not possible when providing just a URL. For example, their Articles rich result requires the height/width properties for the ImageObject value.

1
  • <link itemprop="image" href="{{ imgUrl }}"> should work now too as the documentation states for Image: Repeated ImageObject or URL > The URL to an image that is representative of the article. Only a marked-up image that directly belongs to the article should be specified. Images should be at least 696 pixels wide.
    – LarS
    Jun 3, 2022 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.