1. Go to this page and download the library: Download bnomei/kirby3-feed library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
'routes' => [
// ... other routes,
[
'pattern' => 'sitemap.xml',
'method' => 'GET',
'action' => function () {
// while this would be possible
// return site()->index()->listed()->limit(50000)->sitemap();
// using a closure allows for better performance on a cache hit
return sitemap(fn() => site()->index()->listed()->limit(50000));
}
],
// (optional) Add stylesheet for human readable version of the xml file.
// With that stylesheet visiting the xml in a browser will per-generate the images.
// The images will NOT be pre-generated if the xml file is downloaded (by google).
[
'pattern' => 'sitemap.xsl',
'method' => 'GET',
'action' => function () {
snippet('feed/sitemapxsl');
die;
}
],
],
];