---
title: "tags:afterResolve Hook · Unhead"
canonical_url: "https://unhead.unjs.io/docs/solid-js/head/api/hooks/tags-after-resolve"
last_updated: "2026-09-14T04:03:29.358Z"
meta:
  description: "Final synchronous tag-resolution hook before sanitization and rendering."
  "og:description": "Final synchronous tag-resolution hook before sanitization and rendering."
  "og:title": "tags:afterResolve Hook · Unhead"
---

Home

`
Unhead on GitHub

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

**Hooks**

# **tags:afterResolve Hook**

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

The `**tags:afterResolve**` hook is the final hook in the tag-resolution chain. It runs after [`**tags:resolve**`](https://unhead.unjs.io/docs/head/api/hooks/tags-resolve), but before Unhead removes invalid or empty tags and escapes inline script content.

Both the DOM and SSR renderers use the resulting sanitized array.

## Hook Signature

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

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

This hook is synchronous. Use `**ctx.tags**` to change membership or order. Do not implement your own `**</script>**` escaping here; the resolver performs that sanitization after the hook.

## Usage Example

```
import { defineHeadPlugin } from '@unhead/solid-js/plugins'

const integrityManagedScripts = new Set([
  'https://cdn.example.com/widget/4.2.0/widget.min.js',
])

export const reportMissingIntegrityPlugin = defineHeadPlugin({
  key: 'report-missing-integrity',
  hooks: {
    'tags:afterResolve': ({ tags }) => {
      for (const tag of tags) {
        if (tag.tag === 'script' && integrityManagedScripts.has(tag.props.src) && !tag.props.integrity)
          console.warn(`Integrity-managed script has no integrity attribute: ${tag.props.src}`)
      }
    }
  }
})
```

Keep the allowlist limited to version-pinned assets whose deployed bytes are immutable. For cross-origin scripts, add `**crossorigin: 'anonymous'**` to the tag and ensure the response sends an appropriate `**Access-Control-Allow-Origin**` header; otherwise SRI cannot verify the resource. Subresource Integrity blocks a resource when its bytes no longer match the recorded hash, so it is a poor fit for mutable or unversioned URLs. See MDN's [**~~Subresource Integrity guide~~**](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Subresource_Integrity#no-cors_mode_and_the_crossorigin_attribute).

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

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

**Did this page help you? **

[**tags:resolve** Middle synchronous hook for transforming the deduplicated tag set before rendering.](https://unhead.unjs.io/docs/head/api/hooks/tags-resolve) [**dom:beforeRender** Synchronous hook for allowing or canceling a pending client-side DOM render.](https://unhead.unjs.io/docs/head/api/hooks/dom-before-render)

**On this page **

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