We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b9c0ed1 + 758e029 commit 34700c8Copy full SHA for 34700c8
.changeset/cold-nights-invent.md
@@ -0,0 +1,5 @@
1
+---
2
+"webtools-addon-sitemap": patch
3
4
+
5
+fix: filter duplicate URLs from the sitemap XML
packages/addons/sitemap/server/services/core.js
@@ -193,7 +193,17 @@ const createSitemapEntries = async () => {
193
}
194
195
196
- return sitemapEntries;
+ // Filter out duplicates.
197
+ const allSitemapUrls = new Set();
198
+ const uniqueSitemapEntries = sitemapEntries.filter((entry) => {
199
+ if (allSitemapUrls.has(entry.url)) {
200
+ return false;
201
+ }
202
+ allSitemapUrls.add(entry.url);
203
+ return true;
204
+ });
205
206
+ return uniqueSitemapEntries;
207
};
208
209
/**
0 commit comments