There are already many Kirby sitemap plugins out there: https://github.com/jenstornell/kirby-plugins/issues?utf8=✓&q=is%3Aissue%20is%3Aopen%20sitemap
I always felt limited by them. On my sites I have a “quick and dirty” solution, but this time I wanted to create a long lasting, more elegant solution.
Kirby Sitemap Query - is born
Github: https://github.com/jenstornell/kirby-sitemap-query
A sitemap xml plugin without boundaries.
Add this sitemap-query.php
snippet:
sitemapQuery::add('https://example.com/contact');
sitemapQuery::add(array(
'loc' => 'https://example.com/about',
'lastmod' => '2004-11-23',
'priority' => '0.3',
'changefreq' => 'weekly'
));
It will land on http://example.com/sitemap.xml
.
If no snippet is added it will fallback to all pages:
<?php
foreach( site()->index() as $page ) {
$url['priority'] = ( $page->isHomePage() ) ? 1 : '0.5';
sitemapQuery::add(array(
'loc' => $page->url(),
'lastmod' => $page->modified('Y-m-d'),
'priority' => $url['priority'],
));
}
There are some options and more information which you can read about here: https://github.com/jenstornell/kirby-sitemap-query