From 481a5e3cb55c6fda2c318180cfa0532ed34e4fc5 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Tue, 8 Aug 2023 10:26:06 +0530 Subject: [PATCH] fix: fix sitemap path resolution closes #2749 --- src/node/build/generateSitemap.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/node/build/generateSitemap.ts b/src/node/build/generateSitemap.ts index f94980b3..579141bf 100644 --- a/src/node/build/generateSitemap.ts +++ b/src/node/build/generateSitemap.ts @@ -17,11 +17,12 @@ export async function generateSitemap(siteConfig: SiteConfig) { const getLastmod = async (url: string) => { if (!siteConfig.lastUpdated) return undefined - let path = url.replace(/(^|\/)$/, '$1index') - path = path.replace(/(\.html)?$/, '.md') - path = siteConfig.rewrites.inv[path] || path + let file = url.replace(/(^|\/)$/, '$1index') + file = file.replace(/(\.html)?$/, '.md') + file = siteConfig.rewrites.inv[file] || file + file = path.join(siteConfig.srcDir, file) - return (await getGitTimestamp(path)) || undefined + return (await getGitTimestamp(file)) || undefined } await task('generating sitemap', async () => {