Sitemap to include page assets support images and videos

Google extended the sitemap schema to support images and videos. if SitemapEntry were to include page.assets then supporting these two google schema enhancements would be possible using a custom sitemap.xml template.

Google schemas

 xmlns="http://www.google.com/schemas/sitemap-image/1.1"
 xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"

Given zola page already has a collection of assets. Would be possible to include assets along with the variables currently included with SitemapEntry we could then do something like this:

<urlset
    xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
    xmlns="http://www.google.com/schemas/sitemap-image/1.1"
    xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
{% for sitemap_entry in entries %}
    <url>
       <loc>https://example.com/mens-hats</loc>
       <lastmod>2018-10-12</lastmod>

       {% if sitemap_entry.assets %}
       {% for file in sitemap_entry.assets %}
       {% if file is matching("(jpg/png/gif)") %}

       <image:image>
          …
          
          <image:loc>{{sitemap_entry.assets}}</image:loc>
          <image:caption>{{sitemap_entry.extra.caption-if-you-want}}</image:caption>
          <image:geo_location>Some Location</image:geo_location>
          <image:title>{{sitemap_entry.extra.title-if-you-want}}</image:title>
         ....
       </image:image>
      {% endif %}

    </url>
{% endfor %}
</urlset>

A similar implementation for videos.

Would that break other sitemap parsers? I feel like this is something that people can update themselves and not be built-in as it likely requires some additional caption etc

No, supporting these extensions will not break parsing. Over on sitemaps.org they show how to extend the base XML schema with customisation.

https://www.sitemaps.org/protocol.html#extending

Google’s extension for images and video is compliant with the sitemap scheme.

Yoast and all the wordpress SEO plugins that generate sitemaps conform and support the extentions. So no it will not break any parsers that support sitemap.org schemas.

Google is currently running at 70% of all internet searches, supporting their extensions is desirable.

The only thing missing to do this is a list of assets associated with a page.

I am confused how this is something people can do? There doesn’t seem to be a Zola API to get a complete list of sections, pages or assets. Am I missing something?

Adding assets to SitemapEntry would be very useful in this instance. Or providing a way to loop through all sections/pages/assets would allow developers to roll their own sitemap from scratch.