fix: fix sitemap path resolution

closes #2749
pull/2750/head
Divyansh Singh 1 year ago
parent 20b509c6e1
commit 481a5e3cb5

@ -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 () => {

Loading…
Cancel
Save