3

The reason I ask, is I am making a script that searches a folder for images, so I don't necessarily know where they are used or the exact page. Example from 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>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>

Is it possible to do and would google / other search engines read it properly still?

<?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>
        <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>
3

According to sitemap.xsd the <loc> is required. To be sure, check the result from Google Test Sitemap:Google Test Sitemap Result

  • For Image Search, it always requires an image & landing page pair. It needs the <loc> so that it knows which landing page to associate with the image. – John Mueller Jan 9 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.