Skip to content

Getting Set Up with an Automated Image Sitemap

Image sitemaps enable search engines like Google to more easily and quickly crawl the images on your site. They’re not critical to every website out there, but can be helpful for sites with a lot of image-heavy content, as well as those that render images with client-side JavaScript.

PicPerf will automate the generate of an image sitemap based on the images that have been viewed at least once in the last 90 days.

Opting In to Automated Image Sitemap Generation

By default, image requests will not be added to your image sitemap. In order to add them, add the ?sitemap_path=/current/page/path query parameter to each image URL. These query parameters must include the correct page path for the image to be correctly used in the sitemap. If the same image is used on multiple pages, that same URL must have different sitemap_path values.

For example, if you’re home page, an image URL would look like this:

But that same image on a contact page would look like this:

As long as that query parameter exists and a valid referer header is being included by the visitor’s browser, the image will be included in the resulting sitemap.

Some PicPerf integrations, like WordPress and Statamic will automatically add the sitemap_path parameter based on configuration. See their documentation for more details.

Requesting Your Sitemap

Your sitemap can be requested from the following URL:

As you’ll see, each image request will be organized by page on which it appeared. It’s perfectly fine for the same image to be listed multiple times if appears on different pages. Again, only images requested at least once in the past 90 days will be included.

Using the Sitemap

Google Search Console will not allow you to add a sitemap that does not belong on your current domain. To get around this, you’ll need to either create an endpoint on your site that retrieves the sitemap contents, or set up a URL rewrite that does the same. See the Integrating with Your Site page for more information on setting this up. In most cases, it’s only a few lines of code.