12 lines
472 B
TypeScript
12 lines
472 B
TypeScript
import { existsSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { sharedProfile } from "@/data/portfolio/shared";
|
|
|
|
// Resolve on the server at build time, so the LCP image never starts with a 404.
|
|
// Adding the owner's preferred image and rebuilding automatically selects it.
|
|
export function getHeroImage() {
|
|
return existsSync(path.join(process.cwd(), "public", sharedProfile.heroImage))
|
|
? sharedProfile.heroImage
|
|
: sharedProfile.heroFallbackImage;
|
|
}
|