Skip to content

feat(content): add defineOgImageSchema() composable#520

Merged
harlan-zw merged 1 commit intomainfrom
feat/define-og-image-schema
Mar 23, 2026
Merged

feat(content): add defineOgImageSchema() composable#520
harlan-zw merged 1 commit intomainfrom
feat/define-og-image-schema

Conversation

@harlan-zw
Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Related to nuxt-modules/sitemap#576

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

The asOgImageCollection() wrapper mutates the collection object and depends on schema merge ordering, which caused Nuxt Studio to show injected og-image fields and trigger conflict detection.

defineOgImageSchema() is a new composable that returns the og-image Zod schema directly for users to compose into their own schema: z.object(). It accepts an optional z parameter so users can pass the @nuxt/content patched Zod instance, ensuring .editor({ hidden: true }) works across Zod versions.

asOgImageCollection() is kept but marked @deprecated.

Replace the `asOgImageCollection()` wrapper with `defineOgImageSchema()`
that returns the schema field directly for users to compose into their
own `schema: z.object()`. This avoids collection mutation and prevents
Nuxt Studio from showing injected og-image fields.

`asOgImageCollection()` is kept but marked deprecated.
@harlan-zw harlan-zw merged commit e9cded0 into main Mar 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant