From 8100c5cb2b60780c35c38461a0a279d7bfcdd227 Mon Sep 17 00:00:00 2001 From: "Javier de la Rubia (@fjdelarubia)" Date: Mon, 12 Aug 2024 21:13:40 +0200 Subject: [PATCH] fix: Add html extension if build.format is file --- packages/integrations/sitemap/src/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/integrations/sitemap/src/index.ts b/packages/integrations/sitemap/src/index.ts index 057fc2371d..6b91246264 100644 --- a/packages/integrations/sitemap/src/index.ts +++ b/packages/integrations/sitemap/src/index.ts @@ -132,6 +132,18 @@ const createPlugin = (options?: SitemapOptions): AstroIntegration => { pageUrls = Array.from(new Set([...pageUrls, ...routeUrls, ...(customPages ?? [])])); + if(config.build.format === 'file') { + pageUrls = pageUrls.map((url) => { + + if(url.endsWith('/')) { + return url; + } + + return url + '.html'; + + }); + } + try { if (filter) { pageUrls = pageUrls.filter(filter);