UNPKG

nuxt-og-image

Version:

Enlightened OG Image generation for Nuxt.

18 lines (15 loc) 455 B
import { z } from '@nuxt/content'; const schema = z.object({ ogImage: z.object({ url: z.string().optional(), component: z.string().optional(), props: z.record(z.string(), z.any()) }).optional() }); function asOgImageCollection(collection) { if (collection.type === "page") { collection.schema = collection.schema ? schema.extend(collection.schema.shape) : schema; } return collection; } export { asOgImageCollection, schema };