samdark / sitemap

Sitemap and sitemap index builder
BSD 3-Clause "New" or "Revised" License
534 stars 86 forks source link

Can you add support for image sitemap? #90

Open jasomdotnet opened 2 years ago

jasomdotnet commented 2 years ago

Hi,

I like this repo - so far the simpliest (no stupid requirements) with best documentation. Can you add support for image sitemap? Kindly see this:

jasomdotnet commented 2 years ago

https://www.google.com/schemas/sitemap-image/1.1/ https://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd

jasomdotnet commented 2 years ago

https://developers.google.com/search/blog/2022/05/spring-cleaning-sitemap-extensions?hl=en

jasomdotnet commented 2 years ago

I'd like to add it but currently have not enough time for it. A pull request is welcome though.

Yes, I see it as pull request too :D

jasomdotnet commented 2 years ago

Add images to an existing sitemap, or create a separate sitemap just for your images.

In order to support image sitemap you basically add new sub-lines according this scheme:

<?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/sample1.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>
  <url>
    <loc>http://example.com/sample2.html</loc>
    <image:image>
      <image:loc>http://example.com/picture.jpg</image:loc>
    </image:image>
  </url>
</urlset>

This increases sitemap.xml file-size. So what about "file-limits" in the case of increasing total generating code. This repo counts overall file-size automatically or in potential pull request I need to alter also "file-limits" part?

samdark commented 2 years ago

This repo counts overall file-size automatically or in potential pull request I need to alter also "file-limits" part?

It should count it well but that should be re-checked.