XML Sitemap for Collections
I'm trying to create an XML sitemap for collections.
Everything is working fine apart from the last modified date, which I can't seem to get to work.
header('Content-type: application/xml'); include('perch/runtime.php'); echo '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="https://www.google.com/schemas/sitemap-mobile/1.0">'; perch_collection('Staff Profiles', [ 'template' => 'about/sitemap_profiles.html' ]); echo '</urlset>';
<url> <loc>https://www.wardgethinarcher.co.uk/about/meet-team/<perch:content id="profileSlug" /></loc> <changefreq>monthly</changefreq> <lastmod><perch:pages id="pageModified" format="%Y-%m-%d" /></lastmod> <mobile:mobile/> </url>
I appreciate that
<perch:pages /> doesn't work in the content templates but there is no field in the collection template to include that data.
What's the best way to get the page's last modified date to work, please?