Skip to content

Commit b7f9ad5

Browse files
authored
PRO-9542: fix the bug that breaks sitemaps for RA (#5433)
* PRO-9542: fix the bug that breaks sitemaps for RA * see changeset
1 parent b1c7c9b commit b7f9ad5

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎.changeset/sparkly-experts-walk.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"apostrophe": patch
3+
---
4+
5+
Sites with a custom filterByIndexPage method no longer experience failures in the sitemap module and potential creeping CPU performance penalties. A regression introduced with our static site support, but not specific to static sites.

‎packages/apostrophe/modules/@apostrophecms/piece-page-type/index.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,14 @@ module.exports = {
427427
return metadata;
428428
}
429429
const [ pm ] = metadata;
430+
// indexQuery is designed to be called with the
431+
// index page in question as req.data.page. To
432+
// reuse it for URL metadata purposes we must
433+
// meet that expectation
434+
const pageWas = req.data.page;
435+
req.data.page = doc;
430436
const query = self.indexQuery(req);
437+
req.data.page = pageWas;
431438
const filters = await self.getFiltersWithChoices(query, { allCounts: true });
432439

433440
// 1. Enumerate every filter + choice combination

0 commit comments

Comments
 (0)