Image SEO for a photo library: sitemaps and metadata
Image SEO for a photo library: an image sitemap that names the right file, license and credit structured data, and EXIF and XMP that survive Sharp resizing.
By Hamza Ghouri
Image SEO for a site whose product is photos is a different job from adding alt text to a blog. Google has to find each image page, know which file on it is the image, and know who made it and how to license it. I worked through all of that on a photo marketplace built with Next.js, and almost every layer had a gap. The sitemap listed pages but no images. Structured data was missing the fields Google Images uses for licensing. Credits came from the wrong account. The delivered files carried no metadata at all. This post covers each fix, in the order I would do them on any photo library.
Do images need their own sitemap?
Images do not need a separate sitemap file, but image pages should list their images inside the sitemap you already have. A plain sitemap tells Google where a page is, not which file on it is the image you want indexed. Google's image sitemap documentation shows the image:image element, with up to 1,000 images per URL.
Image SEO starts with a sitemap that names the file
The marketplace's sitemap listed 407 page URLs and zero image:image entries. Google knew where the pages were and never which file to index. Each image page now carries an image:image block:
<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/images/sunset-over-harbour</loc>
<image:image>
<image:loc>https://cdn.example.com/sunset-over-harbour-1024.jpg</image:loc>
</image:image>
</url>
</urlset>
Which file to point at took some thought. The list API returns the small 480px variant, because that is what grid pages need. Image search weighs resolution, so the sitemap points at the medium 1024px variant, the largest one that is publicly served. Larger variants return 403 to the public. After the change I verified the output: 191 entries, all absolute https URLs, valid against the sitemap-image namespace.
The sitemap also had to stay current. It renders on request from the live API (force-dynamic with no-store), so new images and categories appear without a redeploy. It used to include only top-level categories. It now walks the full category tree and skips archived categories, so it lists every page that exists and none that 404.
Structured data Google Images can use
Each image page has a Product with an AggregateOffer whose prices match the license prices on the page. Category pages use CollectionPage with an ItemList of their images. Those help Google understand what the page is.
The fields that matter most for a photo library are the licensing ones. Search Console was reporting "Missing field copyrightNotice" for the image markup. Adding copyrightNotice and creditText to the image schema cleared it, and those are among the fields Google uses for the Licensable badge and the credit line in Google Images:
{
"@context": "https://schema.org",
"@type": "ImageObject",
"contentUrl": "https://cdn.example.com/sunset-over-harbour-1024.jpg",
"license": "https://example.com/license",
"acquireLicensePage": "https://example.com/images/sunset-over-harbour",
"creditText": "Photographer name",
"copyrightNotice": "Photographer name",
"creator": { "@type": "Person", "name": "Photographer name" }
}
Google's image license metadata guide lists what each field does and which ones are required. It also accepts the same information as IPTC photo metadata embedded in the file, which is the next layer.
Alt text and file names that describe the image
I added a dedicated alt text column, and both the public img alt and the Open Graph image alt use it, falling back to the title when it is empty. A title like "Harbour at dusk" is fine for a heading but often too short to describe the picture.
File names got the same treatment. A one-time seeder renamed every image's stored original and CDN preview to a name based on its title. It was written to be idempotent and ran once across the library. Descriptive file names are a small signal, but they cost nothing once the job exists. For Open Graph images specifically, I covered the tags in why Next.js pages share with no image.
Credit is a property of the work, not the uploader
The ImageObject author and creator, the Open Graph author and the visible byline all came from whichever admin account uploaded the file. Five images credited the wrong person, because someone other than the photographer had uploaded them.
Credit is a property of the work. Credit now comes from one configured value instead of the uploader. All 183 image rows were corrected. The uploader's id stays on each row as the audit trail, because who uploaded a file is still worth knowing. It is just a different fact from who made it.
EXIF and XMP that survive resizing
Structured data lives on the page. Metadata embedded in the file travels with it when the image is downloaded or shared. I probed a delivered image and found 0 EXIF tags and no XMP. Sharp discards metadata on resize unless you ask it to keep it with withMetadata. I wrote about the rest of that pipeline in image processing pipelines with Sharp and S3.
The server is pinned to Sharp 0.32.6 for its older CPU. That version writes EXIF but silently ignores an XMP option. So EXIF rides along on the existing watermark encode, and XMP is spliced into the JPEG as a raw APP1 segment, with no second encode. It adds about 1.3KB per image.
The XMP packet carries dc:creator, dc:rights, dc:title, photoshop:Credit, xmpRights:Marked, xmpRights:WebStatement and a plus:Licensor block that points at the image's license page. The splice function returns its input untouched for a non-JPEG or an oversized packet. A metadata problem should never cost the image itself.
Why I did not backfill the existing images
The 191 existing images were deliberately left as they were. Reprocessing them would mint new image ids on the CDN, which would rotate every delivery URL on the same day those URLs were submitted to Google in the new image sitemap. That would throw away exactly the signal the sitemap was built to send. The safe route is written down for later: re-upload under the same id, and verify the rebuilt file before deleting the old one. New uploads get the metadata from now on.
Where I'd start
- Add
image:imageto every image page in the sitemap, pointing at the largest public variant. - Add
license,acquireLicensePage,creditTextandcopyrightNoticeto the image structured data and watch Search Console's warnings clear. - Take credit from the work, not from whoever uploaded it.
- Check a delivered file for EXIF and XMP; if your pipeline strips them, add them back without a second encode.
- Do not change image URLs in the same week you submit them.
If you also want to control how AI crawlers use your images, that is a separate decision, covered in how to block AI training crawlers with robots.txt. This kind of search and media work is part of what I do through my services.