b69252c556
- app/utils/resolve-og-image.ts: absolutises frontmatter image or falls back to /og-blog-default.jpg - public/og-blog-default.jpg: placeholder (copied from og-image.png) — branded 1200x630 design follow-up pending
15 lines
673 B
TypeScript
15 lines
673 B
TypeScript
/**
|
|
* Resolves an article's og:image to an absolute URL.
|
|
* Strategy (D-05): frontmatter `image` if present, else branded fallback `/og-blog-default.jpg`.
|
|
* Consumed by: app/pages/blog/[slug].vue (useSeoMeta.ogImage + defineArticle.image)
|
|
* app/pages/blog/index.vue (useSeoMeta.ogImage fallback only).
|
|
*/
|
|
const SITE_URL = 'https://killiandalcin.fr'
|
|
const FALLBACK = '/og-blog-default.jpg'
|
|
|
|
export function resolveOgImage(article?: { image?: string } | null): string {
|
|
const raw = article?.image?.trim() || FALLBACK
|
|
if (raw.startsWith('http://') || raw.startsWith('https://')) return raw
|
|
return `${SITE_URL}${raw.startsWith('/') ? raw : `/${raw}`}`
|
|
}
|