The short answer

Add one image entry for each important image under the canonical page URL in an XML sitemap. Use a public, absolute URL for the image file, and check that the file loads and its host allows crawling. Add the entries to an existing sitemap or publish a separate image sitemap.

On this page
  1. Decide which images to list
  2. Put the image URLs under the page URL
  3. Check the file from the image host
  4. Publish and check the mapping
  5. Sources & further reading

A public garden guide can have a useful trail photo and a planting diagram on the same page, with the files served from two hosts. An image sitemap gives Google the page URL and the address of each image you want it to discover.

Decide which images to list

Start with images that help someone use the page. Check the published page before generating the sitemap, especially if a template or JavaScript builds its gallery. A sitemap can help Google discover images it might otherwise miss. Keep important images in standard HTML image elements too, with a usable src on the img inside any picture element.

This fictional garden guide has four candidates.

Candidate Decision Reason
Trail entrance photo on the garden guide Include It helps visitors recognize the entrance.
Planting diagram on the same guide, served from the image host Include after checks It explains spacing and has its own public file URL.
A smaller rendition of that same trail photo Omit from this example One stable representative URL keeps the example inventory simple.
A photo from an unfinished private page Omit The file and page are outside the public inventory.

For page selection, use the same principles as the regular XML sitemap guide. If a gallery image is missing from the actual page, check how it loads before adding it to the file.

Put the image URLs under the page URL

You can extend your current sitemap or publish a separate image sitemap. Choose whichever you can keep in sync with the pages. The structure is the same either way. The garden domain serves the photo, and the media domain serves the diagram. The example uses reserved domains.

<?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://garden.example/visit</loc>
    <image:image>
      <image:loc>https://garden.example/entrance.webp</image:loc>
    </image:image>
    <image:image>
      <image:loc>https://media.example/spacing.webp?w=960&amp;v=2</image:loc>
    </image:image>
  </url>
</urlset>

The plain loc points to the page. Each image:loc points to a file and goes in its own image:image block. In XML, write &amp; for a literal ampersand in a URL. When you test that URL in a browser, use the decoded form, such as ?w=960&v=2.

Check the file from the image host

Open the page and each image URL separately in a private window. The image should load from its public address without your account or session. If it returns a login page, an error, or a different image, correct the URL or hosting rule before publishing the sitemap.

For an image on a separate CDN domain, Google’s image sitemap instructions call for verifying both domains in Search Console. Review the image host’s robots.txt for rules that affect the intended path. Suppose the diagram loads in your browser, but the image host disallows its directory for Googlebot-Image. Ask whoever manages the image host to make that specific public image crawlable or choose an accessible location and update the page and sitemap together.

Publish and check the mapping

Fetch the published XML and parse it. Confirm each page URL points to the intended page and each image URL matches a file visible there. An XML parser catches malformed syntax and unescaped characters. Then check that the sitemap and image namespaces match the example and that each image entry sits inside its page’s URL entry. The live file checks tell you whether the references actually resolve.

If you added the entries to a submitted sitemap, keep that sitemap URL stable. If you made a separate file, submit it in Search Console or include it in your sitemap index. A sitemap helps discovery. Google decides what to crawl and index. Keep meaningful image alt text on the page, where it can describe the image in context.

Sources & further reading

Primary references checked Nov 11, 2026. Platform guidance can change.

  1. Google Search Central on image sitemaps
  2. Google Images SEO best practices
  3. Google Search Central on building and submitting sitemaps

AI-assisted research and writing. Learn about our editorial standards.

Suggest a correction ↗