nuxt-og-image:runtime-configType: (config: ModuleOptions) => HookResult
Modify the Nuxt OG Image runtime config at build-time.
export default defineNuxtConfig({
hooks: {
'nuxt-og-image:runtime-config': (config) => {
config.colorPreference = 'dark'
}
}
})
nuxt-og-image:componentsType: (ctx: { components: OgImageComponent[] }) => HookResult
Programmatically modify the components used by the module.
export default defineNuxtConfig({
hooks: {
'nuxt-og-image:components': (ctx) => {
ctx.components = ctx.components.filter(c => c.category !== 'community')
}
}
})
Nitro hooks for runtime OG image generation.
nuxt-og-image:contextType: (ctx: OgImageRenderEventContext) => HookResult
Modify the OG image render context before generation.
export default defineNitroPlugin((nitro) => {
nitro.hooks.hook('nuxt-og-image:context', (ctx) => {
// modify ctx.options, ctx.path, etc.
})
})
nuxt-og-image:satori:vnodesType: (vnodes: VNode, ctx: OgImageRenderEventContext) => HookResult
Modify the Satori vnodes before rendering to SVG.
export default defineNitroPlugin((nitro) => {
nitro.hooks.hook('nuxt-og-image:satori:vnodes', (vnodes, ctx) => {
// modify vnodes before satori processes them
})
})