Skip to content

Commit 6c48b71

Browse files
committed
fix: gracefully exit if there is no default sitemap config found
1 parent 452b0bd commit 6c48b71

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/addons/sitemap/server/bootstrap.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ export default async () => {
5252
strapi.cron.add({
5353
generateDefaultSitemap: {
5454
task: async ({ strapi }) => {
55-
getPluginService('core').createSitemap('default');
55+
const id = 'default';
56+
57+
const config = await getPluginService('settings').getConfig();
58+
const sitemapConfig = config.sitemaps[id];
59+
60+
// Gracefully exit if no sitemap config found
61+
if (!sitemapConfig) {
62+
return;
63+
}
64+
65+
getPluginService('core').createSitemap(id);
5666
},
5767
options: {
5868
rule: cron,

0 commit comments

Comments
 (0)