5

I have an HTML code like this:

<a href="http://example.com/kitten_image.jpg" title="Cute Kittens" download>
  <span title="Cute Kittens">Download</span>
</a>

The problem with the above code is Google search engine is crawling the image with the text available inside the span element, i.e. "Download".

Screenshot from Google Image Search, showing the label 'Download'

I want search engines to crawl the images with the text written inside a/span tag's title attribute, i.e. "Cute Kittens".

How do I modify the above code to do that?

4

The Google crawler is detecting the text inside the span element as the caption of the image in question. There is no way to make Google use the title attribute instead as Google prioritises what's visible to the end user. In addition to that Google uses its extensive experience in image detection and evaluation to identify how to tag images. If you want to have the text show up as "Cute Kitten's" then you would have to place that text in the span element and not in the title attribute. Having said that there is no guarantee that Google will use that either if the indexing algorithm does not consider it to be the best search term to associate with the image in question. Based on your example placing Cute Kitten's in the span element should work as the image is of a kitten (cute or otherwise given the subjective nature of the term "cute").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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