feat: use relative paths for cover images

This commit is contained in:
saicaca
2023-12-28 14:37:18 +08:00
parent 197d524b53
commit 3fcb566a54
4 changed files with 17 additions and 5 deletions

View File

@@ -18,3 +18,11 @@ export function getCategoryUrl(category: string): string | null {
if (!category) return null
return `/archive/category/${category}`
}
export function getDir(path: string): string {
const lastSlashIndex = path.lastIndexOf('/')
if (lastSlashIndex < 0) {
return '/'
}
return path.substring(0, lastSlashIndex + 1)
}