File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ import { getRootUrl } from "utils";
12
12
13
13
const basePath = getRootUrl ( ) ;
14
14
15
+ const addTrailingSlashIfNecessary = ( str : string ) =>
16
+ str . charAt ( str . length - 1 ) === "/" ? str : `${ str } /` ;
17
+
15
18
function createLocalePath ( locale : Locale , path : string , edition ?: string ) {
16
19
const baseLocalePath =
17
20
i18n . defaultLocale === locale ? basePath : `${ basePath } /${ locale } ` ;
@@ -54,7 +57,7 @@ async function getAllConRoutes() {
54
57
routes . push ( createLocalePath ( locale , `con/${ edition } /${ legal } ` ) ) ;
55
58
}
56
59
}
57
- return routes ;
60
+ return routes . map ( ( route ) => addTrailingSlashIfNecessary ( route ) ) ;
58
61
}
59
62
60
63
async function getAllStandardRoutes ( ) {
@@ -92,13 +95,14 @@ async function getAllStandardRoutes() {
92
95
}
93
96
}
94
97
95
- return routes ;
98
+ return routes . map ( ( route ) => addTrailingSlashIfNecessary ( route ) ) ;
96
99
}
97
100
98
101
export default async function sitemap ( ) {
99
102
const allLinks = [
100
- ... ( await getAllConRoutes ( ) ) ,
103
+ basePath ,
101
104
...( await getAllStandardRoutes ( ) ) ,
105
+ ...( await getAllConRoutes ( ) ) ,
102
106
] ;
103
107
return allLinks . map ( ( path ) => ( { url : path } ) ) ;
104
108
}
You can’t perform that action at this time.
0 commit comments