Index of every page on this site: llms.txt
TypeScript
Hooks

entries:resolve Hook

The entries:resolve hook runs at the start of tag resolution, before Unhead normalizes individual entries. It receives a snapshot of the active entries and the resolution context.

Hook Signature

export interface Hook {
  'entries:resolve': (ctx: EntryResolveCtx<any>) => SyncHookResult
}

interface EntryResolveCtx<T> {
  tags: HeadTag[]
  entries: HeadEntry<T>[]
}

Parameters

NameTypeDescription
ctx.entriesHeadEntry<any>[]Snapshot of the entries about to be normalized
ctx.tagsHeadTag[]Resolution array; it is empty when this hook begins

This hook is synchronous. Mutating ctx.entries changes which entries are processed during the current resolution. Entries pushed onto the head itself while resolution is underway are deferred until the next render.

Usage Example

import { defineHeadPlugin } from 'unhead/plugins'

export const inspectEntriesPlugin = defineHeadPlugin({
  key: 'inspect-entries',
  hooks: {
    'entries:resolve': ({ entries }) => {
      console.log(`Resolving ${entries.length} head entries`)
    }
  }
})

Use entries:normalize to change the normalized tags produced by each entry. Use one of the tags:* hooks to inspect or modify the deduplicated tag set.

Did this page help you?