---
title: "ssr:rendered Hook"
description: "Hook for inspecting or synchronously changing the serialized SSR head payload."
canonical_url: "https://unhead.unjs.io/docs/head/api/hooks/ssr-rendered"
last_updated: "2026-08-11T00:40:46.791Z"
---

The `ssr:rendered` hook runs after Unhead serializes all resolved tags. It receives both the tags and the final `SSRHeadPayload`. Synchronous changes to `ctx.html` become the value returned by `head.render()`.

## Hook Signature

```ts
export interface Hook {
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult
}

interface SSRRenderContext {
  tags: HeadTag[]
  html: SSRHeadPayload
}

interface SSRHeadPayload {
  headTags: string
  bodyTags: string
  bodyTagsOpen: string
  htmlAttrs: string
  bodyAttrs: string
}
```

Although the hook type permits a promise, `head.render()` does not await it. Inspect or change the payload synchronously.

## Usage Example

```ts
import { defineHeadPlugin } from '@unhead/dynamic-import/plugins'

export const renderedSizePlugin = defineHeadPlugin({
  key: 'rendered-size',
  hooks: {
    'ssr:rendered': ({ html }) => {
      const size = html.headTags.length + html.bodyTagsOpen.length + html.bodyTags.length
      console.log(`Rendered head payload: ${size} characters`)
    }
  }
})
```

Cache the payload returned by `head.render()` rather than storing request-specific data on `globalThis`.
