Reputation: 2082
I normally tagged illustrations and photographs inside articles as CreativeWork - to credit appropriate authors (creators of visuals).
<article itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">Headline</h1>
<p itemprop="author" itemscope itemtype="http://schema.org/Person">by <span itemprop="name">John Public</span></p>
<figure itemscope itemtype="http://schema.org/CreativeWork">
<img itemprop="image" src="http://example.com/artwork.jpg" alt="Artwork" />
<figcaption itemprop="author" itemscope itemtype="http://schema.org/Person">Illustration by <span itemprop="name">George Smith</span></figcaption>
</figure>
<p>Full content of the article.</p>
</article>
So far so good. Article has its author as well as the illustration, both properly credited.
However, according to the Google validation tool, image is a required attribute for Article type, otherwise the code above is not passing the validation. This is not, however, a requirement of the Article Schema.
How do I escape code duplication, pass Google Schema validation and still credit both authors and illustrators?
Upvotes: 0
Views: 241
Reputation: 96507
Schema.org has no required properties, but consumers, like Google Search, may of course require that certain properties are provided for doing something with your data (e.g., showing a Rich Snippet).
If you want to get Google’s Rich Snippet for Articles, you have to provide the properties headline
, image
, and datePublished
.
If the image represents the article (in contrast to an image that is just part of the article, but not representative), you could use the image
property to reference the ImageObject
¹ from the Article
.
For that, you just have to add the itemprop
to the figure
element:
<figure itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
If the image is not representative, you should not use this (in which case you probably don’t get this Article Rich Snippet). To still be able to reference² the image(s) from the Article
, you could use the hasPart
property:
<figure itemprop="hasPart" itemscope itemtype="http://schema.org/ImageObject">
¹ You are using CreativeWork
, but if the work is an image, you’d ideally use the sub-type ImageObject
and its contentUrl
property.
² If you don’t use a property to reference the ImageObject
from the Article
, they are in no kind of relation. The HTML nesting does not affect the Microdata unless you use itemprop
.
Upvotes: 2