Image sitemaps are a thing

March 30, 2021 , I learned...

Ever build an image carousel or generate some sort of image via JavaScript? Google’s crawlers can parse JavaScript just fine, but might not discover or properly read image data, like location and licensing information. That’s a bummer for the SEO of a page if images represent meaningful content. Images often contain metadata, or schema, that Google exposes in search results. If Google can’t find the images in the first place, then those images might as well contain no metadata at all.

(Some developers prefer to remove metadata because it can decrease the overall size of the image — yay, performance! — but doing so de facto could have adverse SEO implications.)

Anyway, apparently we can explicitly tell Google that there are images on the page and where to find them. It’s called an images sitemap and it looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  <url>
    <loc>http://example.com/sample.html</loc>
    <image:image>
      <image:loc>http://example.com/image.jpg</image:loc>
    </image:image>
    <image:image>
      <image:loc>http://example.com/photo.jpg</image:loc>
    </image:image>
  </url> 
</urlset> 

This way, we can specify up to 1,000 images on any given page and Google will check them out. That goes directly in the page markup! The syntax supports six tags that carry different image details:

  • <image:image> (required): The parent tag for the image location. There can be up to 1,000 of these tags inside of the <url> tag.
  • <image:loc> (required): The URL of the image. This can be a URL from a CDN.
  • <image:caption>: The caption for the image.
  • <image:geo_location>: Where the image takes places. This can be a simple name, like city and state, rather than geo-coordinates.
  • <image:title>: The image title.
  • <image:license>: A URL to the license for the image.

Source: Google Search Central