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.