diff --git a/public/cv.pdf b/public/cv.pdf new file mode 100755 index 0000000..d6d8798 Binary files /dev/null and b/public/cv.pdf differ diff --git a/src/lib/assets.ts b/src/lib/assets.ts index d067641..e2e9124 100644 --- a/src/lib/assets.ts +++ b/src/lib/assets.ts @@ -1,9 +1,9 @@ // Build-time checks for optional static assets. // Astro frontmatter runs at build (SSG), so the filesystem is available here. +// (!) Resolve from the project root, not from import.meta.url - Vite rewrites module URLs +// during the build, so a relative walk up from this file can miss public/ entirely. import { existsSync } from "node:fs"; -import { fileURLToPath } from "node:url"; - -const publicDir = fileURLToPath(new URL("../../public/", import.meta.url)); +import { join } from "node:path"; /** True only when a real CV has been dropped at public/cv.pdf. */ -export const cvAvailable = existsSync(publicDir + "cv.pdf"); +export const cvAvailable = existsSync(join(process.cwd(), "public", "cv.pdf"));