Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fix-autogenerate-publish-unpublish.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 4 additions & 2 deletions packages/addons/sitemap/server/middlewares/auto-generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Loading