Sitemaps are an invaluable resource for search engines, and an important part of a website. They allow search engines to discover contents on a site that would otherwise be impossible to locate, hidden among hundreds and thousands of pages. Along with text content another important element of the web most webmasters ignore are images.
The Google Webmaster blog teaches us how to add images to a sitemap thereby helping crawlers discover them as well. This is particularly true for images that are only accessible via JavaScript forms, or for pages that contain many images but only some of which are integral to the page content.
In the following example, a Sitemap entry for the URL http://example.com/sample.html is shown which contains two images.
<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>
You can add up to 1000 images for each page.
The following table describes the different tags used in the sitemap code.
Tag | Required | Description |
<image:image> |
Yes | Encloses all information about a single image. Each URL (<loc> tag) can include up to 1,000 <image:image> tags. |
<image:loc> |
Yes | The URL of the image. |
<image:caption> |
Optional | The caption of the image. |
<image:geo_location> |
Optional | The geographic location of the image. For example, <image:geo_location>Limerick, Ireland</image:geo_location> . |
<image:title> |
Optional | The title of the image. |
<image:license> |
Optional | A URL to the license of the image. |
Yes, Google collects info about images from alt and title tags.