Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

How can I use itemprop="image" from http://schema.org/Product so Google can recognize it in this case?

<a href="#" itemprop="image" data-remote="images/portfolio/image.jpg" class="portfolio-box" data-toggle="lightbox" data-gallery="multiimages" data-title="image"></a>
share|improve this question
    
What exactly do you mean with "recognize"? Show your image in a product Rich Snippet? And if yes, you are looking for a way to use an image whose URL is given in a custom data-* attribute of an a element instead of the src element of an img element? If yes, why do you want to use a instead of img? –  unor Jul 30 at 13:40
    
Yes, I want to show image in a product Rich Snippet. I got it with a instead of img tag, and I must to do it through a tag and don't know how... –  Lackeeee Jul 30 at 13:53

1 Answer 1

According to Schema.org:

  1. The image property expects a URL or an ImageObject item.

  2. In Microdata, URLs must be specified with one of the HTML elements that take a URL as value. Among them is a (with its href attribute).

  3. So it should be possible to use:

    <a itemprop="image" href="http://example.com/my-product-image.png">…</a>
    

Using custom data-* will most likely not work. Per HTML5 definition they should only be used for custom data private to the site (and not as some kind of shared vocabulary); and anway, how should consumers like Google now what your custom attributes mean/contain?

Also, it’s clearly defined to which content an itemprop applies. In case of a it’s the href attribute content, not the element content, not some other attribute content.

According to Google:

Google doesn’t indicate how exactly their Products Rich Snippet works. Of course do they show in their examples the element that is typically used for images (<img itemprop="image" src="anvil_executive.jpg" />), but their examples don’t mean that it’s the only supported way to specify an image.

share|improve this answer
    
Thank you so much! –  Lackeeee Jul 30 at 17:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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