I have a user profile image in my website and I want to tag it both as "image" and as "name" for a "person" itemtype. The name appears when the user hovers over the image, so I thought about extracting it from the "title" attribute of the image. Can that be done? and if not, what would be the proper solution for this situation?
Thanks alot,
Geva Tal.
No, you can't do that. The value for the itemprop of an img
element is fixed as the resolved absolute url of the src
attribute. There's no mechanism for overriding this.
Instead, wrap the img
in a data
element, assign the name to the value
attribute of that, and add the itemprop="name"
attribute to the data
element as well.