feat(sitemap): add support for "lastmod" (#9954)

This commit is contained in:
Sébastien Lorber 2024-03-20 11:47:44 +01:00 committed by GitHub
parent 465cf4d82c
commit 9017fb9b1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 1449 additions and 359 deletions

View file

@ -92,6 +92,20 @@ export function aliasedSitePath(filePath: string, siteDir: string): string {
return `@site/${relativePath}`;
}
/**
* Converts back the aliased site path (starting with "@site/...") to a relative path
*
* TODO method this is a workaround, we shouldn't need to alias/un-alias paths
* we should refactor the codebase to not have aliased site paths everywhere
* We probably only need aliasing for client-only paths required by Webpack
*/
export function aliasedSitePathToRelativePath(filePath: string): string {
if (filePath.startsWith('@site/')) {
return filePath.replace('@site/', '');
}
throw new Error(`Unexpected, filePath is not site-aliased: ${filePath}`);
}
/**
* When you have a path like C:\X\Y
* It is not safe to use directly when generating code