Search code examples
schema.orgmicrodatagoogle-rich-snippets

Google complains image missing or invalid itemtype


No matter how I mark up the image, Google complains that the image is either missing or has an invalid itemtype.

<html itemscope itemtype="http://schema.org/Article">
 <head>
  ...
  <link itemprop="image" href="https://www.example.com/image.jpg" />
 </head>
 <body>
  <img itemprop="image" src="https://www.example.com/image.jpg" />
 </body>
</html>

How do I add an image to an article?


Solution

  • Schema.org’s image property can have a URL (this is what you do) or an ImageObject as value.

    For Google’s Articles Rich Snippet, Google seems (according to their documentation and their testing tool) to support only the variant with ImageObject.

    So if you want to get that Rich Snippet, you might have to use something like this instead:

    <body itemscope itemtype="http://schema.org/Article">
    
      <div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
        <img itemprop="url" src="https://www.example.com/image.jpg" />
        <meta itemprop="height" content="20" />
        <meta itemprop="width" content="20" />
      </div>
    
    </body>