---
title: "tags:resolve Hook"
description: "Middle synchronous hook for transforming the deduplicated tag set before rendering."
canonical_url: "https://unhead.unjs.io/docs/head/api/hooks/tags-resolve"
last_updated: "2026-08-11T00:39:59.507Z"
---

The `tags:resolve` hook runs after [`tags:beforeResolve`](/docs/head/api/hooks/tags-before-resolve) and before [`tags:afterResolve`](/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

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

```ts
import { defineHeadPlugin } from '@unhead/dynamic-import/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`](/docs/head/guides/plugins/canonical).
