I’m using @pedroborges’ Kirby XML Sitemap plugin, but want to exclude it from being cached. I have tried both of the following cache.ignore settings, but there is still a cache file named sitemap being created.
I think the cache ignore only excludes pages that are in the content folder.
Look at lines 30-32 in the plugin, it looks like it checks the cache before generating a new sitemap.
if (cache::exists('sitemap')) {
return new response(cache::get('sitemap'), 'xml');
}
and line 73…
cache::set('sitemap', $sitemap);
I think if you comment those lines out, it will always generate a new sitemap and not serve the cached one.
I’m not sure that having it cached is an issue though because I believe the cache gets updated when a page changes, which means the cached sitemap should be updated automatically.
@pedroborges is there a better way to keep the sitemap out of the cache without modifying the plugin?
I don’t think it will work, as the code in the plugin does not respect the cache.ignore settings. However, I agree that this setting might be irrelevant, because Kirby flushes the complete cache whenever a page is changed via the Panel.
Also, when I edit and upload individual content files, Kirby’s cache of that file updates automatically. So I don’t worry about having to manually flush the cache for content files. It’s the sitemap that’s being sticky.