entries:normalize Hook · Unhead

[Unhead Home](https://unhead.unjs.io/ "Home")

- [Docs](https://unhead.unjs.io/docs/vue/head/guides/get-started/overview)
- [Tools](https://unhead.unjs.io/tools)
- [Learn](https://unhead.unjs.io/learn/guides/what-is-capo)

[Releases](https://unhead.unjs.io/releases)

Search…```k`` /`

[Unhead on GitHub](https://github.com/unjs/unhead)

[User Guides](https://unhead.unjs.io/docs/vue/head/guides/get-started/overview)

[API](https://unhead.unjs.io/docs/vue/head/api/get-started/overview)

[Releases](https://unhead.unjs.io/docs/vue/releases/v3)

Vue

- [Switch to Vue](https://unhead.unjs.io/docs/vue/head/api/hooks/entries-normalize)
- [Switch to TypeScript](https://unhead.unjs.io/docs/typescript/head/api/hooks/entries-normalize)
- [Switch to React](https://unhead.unjs.io/docs/react/head/api/hooks/entries-normalize)
- [Switch to Svelte](https://unhead.unjs.io/docs/svelte/head/api/hooks/entries-normalize)
- [Switch to Solid.js](https://unhead.unjs.io/docs/solid-js/head/api/hooks/entries-normalize)
- [Switch to Angular](https://unhead.unjs.io/docs/angular/head/api/hooks/entries-normalize)
- [Switch to Nuxt](https://unhead.unjs.io/docs/nuxt/head/api/hooks/entries-normalize)

v3 (stable)

Head

- [Discord Support](https://discord.com/invite/275MBUBvgP)
- [Vue Playground](https://stackblitz.com/edit/github-1ftqrmwn)

- Get Started
  - [Overview](https://unhead.unjs.io/docs/vue/head/api/get-started/overview)
- Composables
  - [`useHead()`](https://unhead.unjs.io/docs/vue/head/api/composables/use-head)
  - [`useHeadSafe()`](https://unhead.unjs.io/docs/vue/head/api/composables/use-head-safe)
  - [`useSeoMeta()`](https://unhead.unjs.io/docs/vue/head/api/composables/use-seo-meta)
  - [`useScript()`](https://unhead.unjs.io/docs/vue/head/api/composables/use-script)
- Hooks
  - [entries:updated](https://unhead.unjs.io/docs/vue/head/api/hooks/entries-updated)
  - [entries:resolve](https://unhead.unjs.io/docs/vue/head/api/hooks/entries-resolve)
  - [entries:normalize](https://unhead.unjs.io/docs/vue/head/api/hooks/entries-normalize)
  - [tag:normalise](https://unhead.unjs.io/docs/vue/head/api/hooks/tag-normalise)
  - [tags:beforeResolve](https://unhead.unjs.io/docs/vue/head/api/hooks/tags-before-resolve)
  - [tags:resolve](https://unhead.unjs.io/docs/vue/head/api/hooks/tags-resolve)
  - [tags:afterResolve](https://unhead.unjs.io/docs/vue/head/api/hooks/tags-after-resolve)
  - [dom:beforeRender](https://unhead.unjs.io/docs/vue/head/api/hooks/dom-before-render)
  - [ssr:beforeRender](https://unhead.unjs.io/docs/vue/head/api/hooks/ssr-before-render)
  - [ssr:render](https://unhead.unjs.io/docs/vue/head/api/hooks/ssr-render)
  - [ssr:rendered](https://unhead.unjs.io/docs/vue/head/api/hooks/ssr-rendered)
  - [script:updated](https://unhead.unjs.io/docs/vue/head/api/hooks/script-updated)
- [Plugins](https://unhead.unjs.io/docs/head/api/plugins)

Hooks

# entries:normalize Hook

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

Last updated Jan 19, 2026 by [Harlan Wilton](https://github.com/harlan-zw) in [docs: sync](https://github.com/unjs/unhead/commit/d2f86454774aa60706628b46a850653e1e4d56d9).

On this page

- [Lifecycle Position](#lifecycle-position)
- [Hook Signature](#hook-signature)
- [Usage Example](#usage-example)
- [Use Cases](#use-cases)

The `entries:normalize` hook is called for each entry when it's being normalized into tags. This hook gives you access to the tags generated from a specific entry, allowing you to transform, add, or remove tags on a per-entry basis.

## [Lifecycle Position](#lifecycle-position)

This hook runs after [`entries:resolve`](https://unhead.unjs.io/docs/head/api/hooks/entries-resolve) and before [`tag:normalise`](https://unhead.unjs.io/docs/head/api/hooks/tag-normalise).

## [Hook Signature](#hook-signature)

```
export interface Hook {
  'entries:normalize': (ctx: { tags: HeadTag[], entry: HeadEntry<any> }) => HookResult
}
```

### [Parameters](#parameters)

| Name | Type | Description |
| --- | --- | --- |
| `ctx` | Object | Context containing the tags and the entry being processed |
| `ctx.tags` | `HeadTag[]` | Array of tags generated from the entry |
| `ctx.entry` | `HeadEntry<any>` | The head entry being normalized |

### [Returns](#returns)

`HookResult` which is either `void` or `Promise<void>`

## [Usage Example](#usage-example)

```
import { createHead } from '@unhead/vue'

const head = createHead({
  hooks: {
    'entries:normalize': (ctx) => {
      // Log the entry being normalized
      console.log('Normalizing entry:', ctx.entry._i)

      // Modify tags from this specific entry
      ctx.tags.forEach((tag) => {
        if (tag.tag === 'meta' && tag.props.name === 'description') {
          // Modify description meta tag content
          tag.props.content += ' (processed by normalize hook)'
        }
      })
    }
  }
})
```

## [Use Cases](#use-cases)

### [Adding Entry-specific Attributes](#adding-entry-specific-attributes)

You can use this hook to add specific attributes based on entry properties:

```
import { defineHeadPlugin } from '@unhead/vue'

export const entrySourcePlugin = defineHeadPlugin({
  hooks: {
    'entries:normalize': (ctx) => {
      // Add a data attribute to all tags from this entry to track source
      ctx.tags.forEach((tag) => {
        if (tag.props && typeof tag.props === 'object') {
          // Store the component or source that created this entry
          tag.props['data-source'] = ctx.entry.options.source || 'unknown'
        }
      })
    }
  }
})
```

### [Conditional Tag Modification](#conditional-tag-modification)

This hook is useful for modifying tags conditionally based on the entry:

```
import { defineHeadPlugin } from '@unhead/vue'

export const developmentInformationPlugin = defineHeadPlugin({
  hooks: {
    'entries:normalize': (ctx) => {
      // Only in development mode
      if (process.env.NODE_ENV === 'development') {
        // Add a custom comment to help with debugging
        ctx.tags.push({
          tag: 'comment',
          textContent: \`Entry ID: ${ctx.entry._i} from ${ctx.entry.options.source || 'unknown'}\`
        })

        // Enhance title tags with entry information
        ctx.tags.forEach((tag) => {
          if (tag.tag === 'title') {
            tag.textContent = \`[DEV] ${tag.textContent}\`
          }
        })
      }
    }
  }
})
```

### [Processing Template Parameters](#processing-template-parameters)

You can use this hook to detect and process template parameters in entries:

```
import { defineHeadPlugin } from '@unhead/vue'

export const templateParamsPlugin = defineHeadPlugin({
  hooks: {
    'entries:normalize': (ctx) => {
      // Extract template parameters from entry
      const params = ctx.tags.find(t => t.tag === 'templateParams')?.props || {}

      if (Object.keys(params).length > 0) {
        // Store params for later processing
        ctx.entry._templateParams = params

        // Remove the templateParams tag as it's not meant for rendering
        ctx.tags = ctx.tags.filter(t => t.tag !== 'templateParams')
      }
    }
  }
})
```

[Edit this page](https://github.com/unjs/unhead/edit/main/docs/head/7.api/hooks/04.entries-normalize.md)

[Markdown For LLMs](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/head/7.api/hooks/04.entries-normalize.md)

Did this page help you?

[entries:resolve Hook for processing head entries before tag conversion. Add global meta tags, extract analytics data, and modify tag collections.](https://unhead.unjs.io/docs/head/api/hooks/entries-resolve) [tag:normalise Hook for processing individual head tags. Apply security attributes, transform tags per environment, and handle custom attributes.](https://unhead.unjs.io/docs/head/api/hooks/tag-normalise)

On this page

- [Lifecycle Position](#lifecycle-position)
- [Hook Signature](#hook-signature)
- [Usage Example](#usage-example)
- [Use Cases](#use-cases)

[GitHub](https://github.com/unjs/unhead) [ Discord](https://discord.com/invite/275MBUBvgP)

[ /llms.txt](https://unhead.unjs.io/llms.txt)

[Part of the UnJS ecosystem](https://unjs.io/)

### Head Management

- [Getting Started](https://unhead.unjs.io/docs/vue/head/guides/get-started/overview)
- [useHead](https://unhead.unjs.io/docs/vue/head/api/composables/use-head)
- [useSeoMeta](https://unhead.unjs.io/docs/vue/head/api/composables/use-seo-meta)
- [useHeadSafe](https://unhead.unjs.io/docs/vue/head/api/composables/use-head-safe)
- [useScript](https://unhead.unjs.io/docs/vue/head/api/composables/use-script)

### Schema.org

- [Getting Started](https://unhead.unjs.io/docs/vue/schema-org/guides/get-started/overview)
- [useSchemaOrg](https://unhead.unjs.io/docs/vue/schema-org/api/composables/use-schema-org)
- [Nodes](https://unhead.unjs.io/docs/vue/schema-org/guides/core-concepts/nodes)
- [Recipes](https://unhead.unjs.io/docs/vue/schema-org/guides/recipes/identity)

### Guides

- [Titles](https://unhead.unjs.io/docs/vue/head/guides/core-concepts/titles)
- [Streaming SSR](https://unhead.unjs.io/docs/vue/head/guides/core-concepts/streaming)
- [DOM Events](https://unhead.unjs.io/docs/vue/head/guides/core-concepts/dom-event-handling)
- [Plugins](https://unhead.unjs.io/docs/vue/head/guides/plugins/template-params)

### Tools

- [Meta Tag Generator](https://unhead.unjs.io/tools/meta-tag-generator)
- [OG Image Generator](https://unhead.unjs.io/tools/og-image-generator)
- [Schema.org Generator](https://unhead.unjs.io/tools/schema-generator)
- [Capo.js Analyzer](https://unhead.unjs.io/tools/capo-analyzer)

### Articles

- [What is Capo.js?](https://unhead.unjs.io/learn/guides/what-is-capo)

### Research

- [State of <head> in 2026](https://unhead.unjs.io/learn/research/state-of-head-2026)
- [Streaming Head Performance](https://unhead.unjs.io/learn/research/streaming-head-performance)
- [Capo.js Performance Research](https://unhead.unjs.io/learn/research/capo-performance-research)

Copyright © 2025-2026 Harlan Wilton - [MIT License](https://github.com/unjs/unhead/blob/main/license)