Check 16.14 · Images and multimodal search

Create an image sitemap if needed

Decide whether an image sitemap is useful to you, then generate it with WordPress, Shopify, PrestaShop, Magento, Drupal, Laravel or Next.js and submit it.

Priority
Important
Difficulty
Intermediate
Estimated time
1 to 3 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

An image sitemap is an XML sitemap extended with <image:image> tags that list, for each page, the images it contains. It helps Google discover images it would not find on its own, especially those loaded by JavaScript or served from a CDN. It is not essential: if your images are img elements present in the HTML, Google finds them by crawling the pages. The task is to decide whether you need one, then generate it automatically and submit it.

Why it matters

Google discovers images through the src attribute of img elements on the pages it crawls. This mechanism fails in a few cases: galleries and carousels that insert images with JavaScript, lightboxes that only load the large image on click, lazy-loaded images whose URL is not in any src attribute. Google's documentation presents the image sitemap as a way to point out images it might not otherwise find.

The format is simple. Only two tags are supported: <image:image>, which wraps an image, and <image:loc>, its URL. Each <url> can contain up to 1,000 images. The old <image:caption>, <image:title>, <image:geo_location> and <image:license> tags were removed from the documentation in 2022: Google no longer uses them, and the caption and license are provided in the page and in the image metadata (opens in a new tab).

Image URLs can be on a different domain from the page, a CDN for example: Google accepts this, provided that host's robots.txt does not disallow crawling.

What it improves

  • Image discovery Especially images loaded by JavaScript or displayed after an interaction.
  • Indexing in Google Images Indirect. The sitemap points out the image; it guarantees neither indexing nor ranking.
  • Page-image association The sitemap states explicitly on which page the image is used.
  • Sites concerned E-commerce catalogs, portfolios, photographers' sites, media outlets, galleries. For a brochure site whose images are in the HTML, the effect is negligible.

How to check

Do you need an image sitemap? Answer these questions:

Question If yes
Are important images inserted by JavaScript (gallery, carousel, lightbox)? Image sitemap useful
Are large images only loaded on click? Image sitemap useful
Does your traffic depend on Google Images (photography, fashion, home decor, recipes, catalog)? Image sitemap recommended
Are all images img elements with a src in the initial HTML? Not needed

Does your sitemap already contain images? Many CMSs add them without saying so:

curl -s https://example.com/sitemap.xml | head -20
curl -s https://example.com/product-sitemap.xml | grep -c "<image:loc>"

A number above zero means the images are already declared. Check that they point to files that return 200:

curl -s https://example.com/product-sitemap.xml | grep -o "<image:loc>[^<]*" | sed 's/<image:loc>//' | head -50 \
  | while read url; do echo "$(curl -s -o /dev/null -w '%{http_code}' "$url") $url"; done | grep -v "^200"

No output lines: the first fifty images all return 200.

In Search Console, the Sitemaps report shows whether the file was read without errors.

How to implement

Before you start

Reference format, to add to an existing sitemap or to publish in a separate file (both are equivalent for Google):

<?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>https://example.com/thes/the-vert/sencha/</loc>
    <image:image>
      <image:loc>https://cdn.example.com/images/sencha-feuilles-seches.jpg</image:loc>
    </image:image>
    <image:image>
      <image:loc>https://cdn.example.com/images/sencha-infusion-tasse.jpg</image:loc>
    </image:image>
  </url>
</urlset>

Rules:

  • List useful images (product, completed work, diagram), not icons, logos and decorative images.
  • Only declare indexable pages and images that return 200: see exclude redirects, errors and noindex pages (opens in a new tab).
  • Use the URL actually served in the page (same domain, same format), not the high-resolution original stored elsewhere.
  • The usual limits apply: 50,000 URLs and 50 MB uncompressed per file; beyond that, use a sitemap index.

WordPress

Versions WordPress 6.4 and later, Yoast SEO and Rank Math in their November 2026 versions.

  • Yoast SEO: the sitemaps (/sitemap_index.xml) normally list the images in your content; check this with the grep -c command from the “How to check” section. If a page builder or theme hides them, the wpseo_sitemap_urlimages filter lets you add them:
add_filter('wpseo_sitemap_urlimages', function (array $images, int $postId): array {
    $galleryIds = get_post_meta($postId, '_galerie_ids', true);

    if (! is_array($galleryIds)) {
        return $images;
    }

    foreach ($galleryIds as $attachmentId) {
        $images[] = ['src' => wp_get_attachment_url($attachmentId)];
    }

    return $images;
}, 10, 2);

Adapt the _galerie_ids key to the way your theme stores the gallery.

  • Rank Math: Rank Math SEO > Sitemap Settings > General, “Images in Sitemaps” and “Include Featured Images” options.
  • WordPress's native sitemap (/wp-sitemap.xml): it contains no images. Use an SEO plugin if you need them.

Shopify

Versions Shopify admin, all plans, November 2026.

Shopify generates /sitemap.xml automatically. According to its help center, the products sitemap includes each product's main image. The other gallery images are not listed and the file cannot be edited: they are still discovered by crawling product pages, where the theme displays them as img elements.

PrestaShop

Versions PrestaShop 8 and 9, Google sitemap module (gsitemap) 4 and 5 (version 5 requires PrestaShop 8.2 or later).

The native Google sitemap module (gsitemap) adds the product's images to product URLs, and one image to categories and brands. After installation, generate the file from the module's configuration page and schedule regeneration with the cron task URL it provides. This URL changed with version 4.4 of the module: after an update, copy the one shown on the configuration page again.

Magento

Versions Magento Open Source and Adobe Commerce 2.4.6 to 2.4.9.

Stores > Settings > Configuration > Catalog > XML Sitemap, “Products Options” section: set “Add Images into Sitemap” to Base Only (main image) or All (all images). Then regenerate the sitemap from Marketing > SEO & Search > Site Map.

Drupal

Versions Drupal 10.3 and later, Drupal 11, Simple XML Sitemap module 4.

The Simple XML Sitemap module generates image sitemaps. Enable the “Include images” option in the settings of the relevant content type (Configuration > Search and metadata > Simple XML Sitemap, Inclusion tab, or the Simple XML Sitemap tab of the content type form), then regenerate the sitemap. Images come from the entity's image fields.

Laravel

Versions Laravel 11 to 13, spatie/laravel-sitemap 7 and 8 (version 8 requires Laravel 12 and PHP 8.4).

With the spatie/laravel-sitemap package:

composer require spatie/laravel-sitemap

Create an Artisan command, for example app/Console/Commands/GenerateSitemapCommand.php:

<?php

namespace App\Console\Commands;

use App\Models\Product;
use Illuminate\Console\Command;
use Spatie\Sitemap\Sitemap;
use Spatie\Sitemap\Tags\Url;

class GenerateSitemapCommand extends Command
{
    protected $signature = 'generate-sitemap';

    protected $description = 'Generate the XML sitemap with product images';

    public function handle(): void
    {
        $sitemap = Sitemap::create();

        Product::query()->where('is_published', true)->with('images')->each(function (Product $product) use ($sitemap) {
            $url = Url::create(route('products.show', $product))->setLastModificationDate($product->updated_at);

            foreach ($product->images as $image) {
                $url->addImage($image->public_url);
            }

            $sitemap->add($url);
        });

        $sitemap->writeToFile(public_path('sitemap.xml'));

        $this->comment('Sitemap generated.');
    }
}

Only add the image URL: the other parameters of addImage() (caption, title, license) produce tags that Google no longer uses. Schedule the command in routes/console.php, with the Illuminate\Support\Facades\Schedule facade: Schedule::command('generate-sitemap')->daily();.

Next.js

Versions Next.js 15 and 16 (App Router).

In app/sitemap.ts, the images property of each entry produces the <image:image> tags:

import type { MetadataRoute } from 'next';
import { getProducts } from '@/lib/products';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const products = await getProducts();

  return products.map((product) => ({
    url: `https://example.com/produits/${product.slug}`,
    lastModified: product.updatedAt,
    images: product.images.map((image) => image.url),
  }));
}

Image URLs must be absolute. If you serve images through next/image, declare the publicly accessible URL of the source file, not an ephemeral /_next/image?… URL.

Static site or other CMS

Without a built-in generator, produce the file from your pages' HTML with a script, or with a crawler: Screaming Frog generates an XML sitemap (Sitemaps > XML Sitemap) with an option to include images.

Submit the sitemap

  1. Declare it in robots.txt: Sitemap: https://example.com/sitemap-images.xml. See declare sitemaps in robots.txt (opens in a new tab).
  2. Submit it in Search Console's Sitemaps report and in Bing Webmaster Tools.
  3. If the images are on a CDN with a different domain, Google recommends verifying that domain in Search Console as well.

Common mistakes

  • Creating an image sitemap when all images are in the HTML: work for no gain, and one more file to maintain.
  • Filling in <image:caption> and <image:title> in the belief that it helps SEO: Google no longer reads these tags.
  • Declaring images that return 404 after a redesign or a CDN change.
  • Listing the high-resolution original when the page displays a different URL: Google sees two different images.
  • Including the icons, logos and pictograms of every page: noise.
  • A static file that is never regenerated: new products are missing and old ones stay listed.
  • Blocking the CDN in its own robots.txt: the declared images cannot be crawled.

Frequently asked questions

Is an image sitemap mandatory?

No. Google discovers images by crawling the img elements on your pages. An image sitemap is only useful if important images escape this crawling, for example when they are loaded by JavaScript or only on click, or if your traffic depends heavily on Google Images. For a brochure site whose images are in the HTML, it adds almost nothing.

Do images need a separate file?

No. Google accepts either image tags added to your existing sitemap or a separate image sitemap. A separate file makes it easier to track errors and regenerate a large catalog; built-in tags save you an extra file. In both cases, declare the sitemap in robots.txt and submit it in Search Console.

Which tags should an image sitemap use?

Only image:image, which wraps each image, and image:loc, which gives its URL. The image:caption, image:title, image:geo_location and image:license tags were removed from Google's documentation in 2022 and are no longer used. Each page URL can list up to 1,000 images. The caption and license are provided in the page and in the image's metadata.

Can images hosted on a CDN be included in the sitemap?

Yes. In image:loc, Google accepts image URLs on a different domain from the page, which is the case with CDNs. Two conditions apply: the CDN domain's robots.txt must not disallow crawling the images, and Google recommends verifying that domain in Search Console as well so you can track any errors.

Updated on

Topic checklist (PDF)

And now?

In the “Images and multimodal search” topic

  1. Use descriptive file names
  2. Write relevant ALT text without keyword stuffing
  3. Use WebP/AVIF if appropriate
  4. Compress images
  5. Size images appropriately
  6. Use srcset and sizes
  7. Set width/height
  8. Lazy-load offscreen images
  9. Optimize key images
  10. Add captions if relevant
  11. Use original images
  12. Provide textual context
  13. Allow crawler access
  14. Create an image sitemap if needed
  15. Fix broken images
  16. Check rights and credits
  17. Measure Google Images visibility
  18. Test multimodal searches