diff --git a/packages/integrations/sitemap/src/index.ts b/packages/integrations/sitemap/src/index.ts index 7e0ef4fa6ad45..825e8e3060e98 100644 --- a/packages/integrations/sitemap/src/index.ts +++ b/packages/integrations/sitemap/src/index.ts @@ -94,7 +94,7 @@ const createPlugin = (options?: SitemapOptions): AstroIntegration => { * remove the initial slash from relative pathname * because `finalSiteUrl` always has trailing slash */ - const path = finalSiteUrl.pathname + r.pathname.substring(1); + const path = finalSiteUrl.pathname + r.generate(r.pathname).substring(1); const newUrl = new URL(path, finalSiteUrl).href; urls.push(newUrl); }