Skip to content

Commit 481a5e3

Browse files
committedAug 8, 2023
fix: fix sitemap path resolution
closes #2749
1 parent 20b509c commit 481a5e3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎src/node/build/generateSitemap.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ export async function generateSitemap(siteConfig: SiteConfig) {
1717
const getLastmod = async (url: string) => {
1818
if (!siteConfig.lastUpdated) return undefined
1919

20-
let path = url.replace(/(^|\/)$/, '$1index')
21-
path = path.replace(/(\.html)?$/, '.md')
22-
path = siteConfig.rewrites.inv[path] || path
20+
let file = url.replace(/(^|\/)$/, '$1index')
21+
file = file.replace(/(\.html)?$/, '.md')
22+
file = siteConfig.rewrites.inv[file] || file
23+
file = path.join(siteConfig.srcDir, file)
2324

24-
return (await getGitTimestamp(path)) || undefined
25+
return (await getGitTimestamp(file)) || undefined
2526
}
2627

2728
await task('generating sitemap', async () => {

0 commit comments

Comments
 (0)
Please sign in to comment.