feat(07-02): add resolveOgImage helper + og-blog-default.jpg fallback asset
- 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
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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}`}`
|
||||
}
|
||||
Reference in New Issue
Block a user