From fd328ee6f62d52a57be67bc08041f6b1bfe7151c Mon Sep 17 00:00:00 2001 From: kupets Date: Tue, 19 May 2026 21:18:52 +0300 Subject: [PATCH 1/2] fix(sitemap): trigger autoGenerate on publish and unpublish actions In Strapi 5, publish and unpublish are separate document service actions and do not go through the update action. The previous allowlist only included create, update and delete, so publishing or unpublishing a document never triggered sitemap regeneration. Adds publish and unpublish to the allowlist so autoGenerate works correctly in Strapi 5 draft-and-publish workflows. Fixes #416 --- packages/addons/sitemap/server/middlewares/auto-generate.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/addons/sitemap/server/middlewares/auto-generate.js b/packages/addons/sitemap/server/middlewares/auto-generate.js index 5aa4984e..b7b5bd03 100644 --- a/packages/addons/sitemap/server/middlewares/auto-generate.js +++ b/packages/addons/sitemap/server/middlewares/auto-generate.js @@ -17,8 +17,10 @@ const autoGenerateMiddleware = async (context, next) => { return next(); } - // Only add the middleware for the create, update and delete action. - if (!['create', 'update', 'delete'].includes(action)) { + // Only add the middleware for the create, update, delete, publish and unpublish actions. + // In Strapi 5, publish and unpublish are separate document service actions and do not + // go through update, so they must be explicitly included here. + if (!['create', 'update', 'delete', 'publish', 'unpublish'].includes(action)) { return next(); } From 75e708b22df714dec2f8f979dd5ec2022f162060 Mon Sep 17 00:00:00 2001 From: kupets Date: Tue, 19 May 2026 21:21:46 +0300 Subject: [PATCH 2/2] chore: add changeset for publish/unpublish autoGenerate fix --- .changeset/fix-autogenerate-publish-unpublish.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/fix-autogenerate-publish-unpublish.md diff --git a/.changeset/fix-autogenerate-publish-unpublish.md b/.changeset/fix-autogenerate-publish-unpublish.md new file mode 100644 index 00000000..1cb013da --- /dev/null +++ b/.changeset/fix-autogenerate-publish-unpublish.md @@ -0,0 +1,7 @@ +--- +"webtools-addon-sitemap": patch +--- + +fix(sitemap): trigger autoGenerate on publish and unpublish actions + +In Strapi 5, publish and unpublish are separate document service actions and do not go through the update action. Adds both to the autoGenerateMiddleware allowlist so the sitemap regenerates immediately on publish/unpublish.