@@ -387,16 +387,23 @@ export class Renderer {
387
387
async getSitemap ( ) : Promise < Sitemap > {
388
388
const sitemap : Sitemap = { } ;
389
389
const sitemapItemAlts : Record < string , Record < string , string > > = { } ;
390
+ const trailingSlash = this . rootConfig . server ?. trailingSlash || false ;
390
391
391
392
await this . router . walk ( async ( urlPath : string , route : Route ) => {
392
393
const routePaths = await this . router . getAllPathsForRoute ( urlPath , route ) ;
393
394
routePaths . forEach ( ( routePath ) => {
394
395
const routeLocale = route . isDefaultLocale ? 'x-default' : route . locale ;
395
- const defaultUrlPath = replaceParams ( route . routePath , routePath . params ) ;
396
+ const defaultUrlPath = normalizeUrlPath (
397
+ replaceParams ( route . routePath , routePath . params ) ,
398
+ { trailingSlash : trailingSlash }
399
+ ) ;
396
400
if ( ! sitemapItemAlts [ defaultUrlPath ] ) {
397
401
sitemapItemAlts [ defaultUrlPath ] = { } ;
398
402
}
399
- sitemapItemAlts [ defaultUrlPath ] [ routeLocale ] = urlPath ;
403
+ sitemapItemAlts [ defaultUrlPath ] [ routeLocale ] = normalizeUrlPath (
404
+ replaceParams ( urlPath , routePath . params ) ,
405
+ { trailingSlash : trailingSlash }
406
+ ) ;
400
407
const sitemapItem : SitemapItem = {
401
408
urlPath : routePath . urlPath ,
402
409
route,
0 commit comments