Hi I added a site map to my website after following this tutorial: Sitemap for search engines | Kirby CMS. However when I go to mydomain.com/sitemap as advised at the bottom here I get a 404 error. I have also set cache to not active in this same file and this does not work either so I am under the impression this file has not been written correctly.
<?php
return [
'debug' => true
];
c::set('routes', array(
array(
// in 'pattern', enter the same url being called from your ajax javascript function
'pattern' => '.../templates/contact.php',
'method' => 'POST',
'action' => function() {
// check whether this is an ajax request, and respond with an error if it isn't
if(!kirby()->request()->ajax()){ return response::error("Page Not Found!","404");}
// process the form data, send the email - and get the result (as an array)
$data = mailFormData(kirby()->request()->data());
// respond with the result - in JSON format
return response::json($data);
}
)
));
return [
'cache' => [
'pages' => [
'active' => false,
'ignore' => function ($page) {
return $page->title()->value() === 'Do not cache me';
}
]
]
];
return [
'smartypants' => true
];
return [
'routes' => [
[
'pattern' => 'sitemap.xml',
'action' => function() {
$pages = site()->pages()->index();
// fetch the pages to ignore from the config settings,
// if nothing is set, we ignore the error page
$ignore = kirby()->option('sitemap.ignore', ['error']);
$content = snippet('sitemap', compact('pages', 'ignore'), true);
// return response with correct header type
return new Kirby\Cms\Response($content, 'application/xml');
}
],
[
'pattern' => 'sitemap',
'action' => function() {
return go('sitemap.xml', 301);
}
]
]
];