---
title: "ssr:rendered Hook · Unhead"
canonical_url: "https://unhead.unjs.io/docs/svelte/head/api/hooks/ssr-rendered"
last_updated: "2026-08-08T00:46:32.025Z"
meta:
  description: "Hook for inspecting or synchronously changing the serialized SSR head payload."
  "og:description": "Hook for inspecting or synchronously changing the serialized SSR head payload."
  "og:title": "ssr:rendered Hook · Unhead"
---

Home

`
Unhead on GitHub

Switch to SvelteSwitch to TypeScriptSwitch to VueSwitch to ReactSwitch to Solid.jsSwitch to AngularSwitch to Nuxt

**Hooks**

# **ssr:rendered Hook**

[Copy for LLMs](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/head/7.api/hooks/14.ssr-rendered.md)

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

```
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

```
import { defineHeadPlugin } from '@unhead/svelte/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**`.

[~~Edit this page~~](https://github.com/unjs/unhead/edit/main/docs/head/7.api/hooks/14.ssr-rendered.md)

[~~Markdown For LLMs~~](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/head/7.api/hooks/14.ssr-rendered.md)

**Did this page help you? **

[**ssr:render** Hook for changing resolved tags and per-render serialization options during SSR.](https://unhead.unjs.io/docs/head/api/hooks/ssr-render) [**script:updated** Internal hook emitted when a managed script starts loading, loads, fails, or is removed.](https://unhead.unjs.io/docs/head/api/hooks/script-updated)

**On this page **

- [Hook Signature](#hook-signature)
- [Usage Example](#usage-example)