Hi,
I am trying set up my sitemap.xml to include cover image of any given page listed there.
Despite setting up sitemap template in such a way:
<?= '<?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">
<?php foreach ($pages as $p): ?>
<?php if (in_array($p->uri(), $ignore)) continue ?>
<url>
<loc><?= html($p->url()) ?></loc>
<lastmod><?= $p->modified('c') ?></lastmod>
<priority><?= ($p->isHomePage()) ? 1 : number_format(0.5 / $p->depth(), 1) ?></priority>
<?php if ($p->cover()->isNotEmpty()): ?>
<image:image>
<image:loc><?= html($p->cover()->url()) ?></image:loc>
</image:image>
<?php endif; ?>
</url>
<?php endforeach ?>
</urlset>
I am being served finally with these (see code below). Please note that I am getting no URL to the image just - file://….
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
<url>
<loc>https://example.com/samplepage</loc>
<lastmod>2025-02-26T10:27:57+01:00</lastmod>
<priority>0.5</priority>
<image:image>
<image:loc>- file://4hlkBiVWqWqaJKt6</image:loc>
</image:image>
</url>