---
title: "tags:resolve Hook · Unhead"
canonical_url: "https://unhead.unjs.io/docs/svelte/head/api/hooks/tags-resolve"
last_updated: "2026-09-15T02:28:50.223Z"
meta:
  description: "Middle synchronous hook for transforming the deduplicated tag set before rendering."
  "og:description": "Middle synchronous hook for transforming the deduplicated tag set before rendering."
  "og:title": "tags:resolve Hook · Unhead"
---

Home

`
Unhead on GitHub

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

**Hooks**

# **tags:resolve Hook**

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

The `**tags:resolve**` hook runs after [`**tags:beforeResolve**`](https://unhead.unjs.io/docs/head/api/hooks/tags-before-resolve) and before [`**tags:afterResolve**`](https://unhead.unjs.io/docs/head/api/hooks/tags-after-resolve). Built-in plugins use it for transformations such as canonical URL resolution, alias-based sorting, and template-parameter substitution.

Core deduplication has already happened before this hook runs.

## Hook Signature

```
export interface Hook {
  'tags:resolve': (ctx: TagResolveContext) => SyncHookResult
}

interface TagResolveContext {
  tagMap: Map<string, HeadTag>
  tags: HeadTag[]
}
```

This hook is synchronous. Change `**ctx.tags**` when adding, removing, or reordering members of the resolved set. Use `**tagMap**` for identity lookups; use `**ctx.tags**` to iterate because arrayable meta groups can be represented by an aggregate map value at runtime.

## Usage Example

```
import { defineHeadPlugin } from '@unhead/svelte/plugins'

export const absoluteImagePlugin = defineHeadPlugin({
  key: 'absolute-images',
  hooks: {
    'tags:resolve': ({ tags }) => {
      for (const tag of tags) {
        const key = tag.props.property || tag.props.name
        if (tag.tag === 'meta' && (key === 'og:image' || key === 'twitter:image'))
          tag.props.content = new URL(tag.props.content, 'https://example.com').href
      }
    }
  }
})
```

For canonical URL handling, prefer the built-in [`**CanonicalPlugin**`](https://unhead.unjs.io/docs/head/guides/plugins/canonical).

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

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

**Did this page help you? **

[**tags:beforeResolve** First synchronous hook over the normalized, deduplicated tag set.](https://unhead.unjs.io/docs/head/api/hooks/tags-before-resolve) [**tags:afterResolve** Final synchronous tag-resolution hook before sanitization and rendering.](https://unhead.unjs.io/docs/head/api/hooks/tags-after-resolve)

**On this page **

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