Nitro Hooks · Nuxt OG Image · Nuxt SEO

-
-
-
-

[1.4K](https://github.com/harlan-zw/nuxt-seo)

[Nuxt SEO on GitHub](https://github.com/harlan-zw/nuxt-seo)

You're viewing **OG Image v5** documentation. For the latest,

.

OG Image

-
-
-
-
-
-
-
-
-
-

Search…```k`` /`

v5

- Playgrounds
- [Discord Support](https://discord.com/invite/275MBUBvgP)

### Nuxt API

-
-
-
-
-
-

### Nitro API

-

Nitro API

# Nitro Hooks

[Copy for LLMs](https://nuxtseo.com/docs/og-image/v5/nitro-api/nitro-hooks.md)

Runtime hooks for Nuxt OG Image.

## [`nuxt-og-image:context`](#nuxt-og-imagecontext)

**Type:** `async (ctx: OgImageRenderEventContext) => void | Promise<void>`

Called when the render context is generated. Within this object you can the entire behaviour of the render.

server/plugins/ogImage.ts

```
import { defineNitroPlugin } from 'nitropack/runtime/plugin'

export default defineNitroPlugin((nitroApp) => {
  nitroApp.hooks.hook('nuxt-og-image:context', async (ctx) => {
    // e is the H3Event
    if (!ctx.e.path.startsWith('/fancy-og-images/'))
      return

    // modify props (usually better suited in route rules)
    ctx.options.props.isFancy = true
    // make all images use the same cache key
    ctx.key = 'fancy-og-images'
  })
})
```

## [`nuxt-og-image:satori:vnodes`](#nuxt-og-imagesatorivnodes)

**Type:** `async (vnodes: VNode[]) => void | Promise<void>`

Called when the Satori vnodes are generated. Using this hook you can modify the final content that is passed to Satori.

server/plugins/ogImage.ts

```
import { defineNitroPlugin } from 'nitropack/runtime/plugin'

export default defineNitroPlugin((nitroApp) => {
  nitroApp.hooks.hook('nuxt-og-image:satori:vnodes', async (vnodes) => {
    for (const child of vnodes.children) {
      // remove icon class from Nuxt Icon
      if (child.prop.class)
        child.prop.class = child.props.class.replace('icon', '')
    }
  })
})
```

[Edit this page](https://github.com/nuxt-modules/og-image/blob/v5.1.13/docs/content/5.nitro-api/4.nitro-hooks.md)

[Markdown For LLMs](https://nuxtseo.com/docs/og-image/v5/nitro-api/nitro-hooks.md)

Did this page help you?

On this page

- [nuxt-og-image:context](#nuxt-og-imagecontext)
- [nuxt-og-image:satori:vnodes](#nuxt-og-imagesatorivnodes)

[GitHub](https://github.com/harlan-zw/nuxt-seo) [ Discord](https://discord.com/invite/275MBUBvgP)

###

-
-

Modules

-
-
-
-
-
-
-
-
-

###

-
-
-

###

Nuxt

-
-
-
-
-

Vue

-
-
-
-
-
-
-
-

###

-
-
-
-
-
-
-
-
-
-

Copyright © 2023-2026 Harlan Wilton - [MIT License](https://github.com/harlan-zw/nuxt-seo/blob/main/license) · [mdream](https://mdream.dev)