UNPKG

nuxt-og-image

Version:

Enlightened OG Image generation for Nuxt.

21 lines (17 loc) 569 B
'use strict'; const content = require('@nuxt/content'); const schema = content.z.object({ ogImage: content.z.object({ url: content.z.string().optional(), component: content.z.string().optional(), props: content.z.record(content.z.string(), content.z.any()) }).optional() }); function asOgImageCollection(collection) { if (collection.type === "page") { collection.schema = collection.schema ? schema.extend(collection.schema.shape) : schema; } return collection; } exports.asOgImageCollection = asOgImageCollection; exports.schema = schema;