Unhead · Full stack <head> package

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

- [Docs](https://unhead.unjs.io/docs/typescript/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)

[🌊 Unhead v3 is here](https://unhead.unjs.io/docs/releases/v3)

# The full stack <head> package for any framework.

Unhead wraps your document template, improving reactive SSR JavaScript framework SEO and performance.

[Get Started](https://unhead.unjs.io/docs/typescript/head/guides/get-started/overview) [ Install Unhead](https://unhead.unjs.io/docs/typescript/head/guides/get-started/installation)

[Switch to TypeScript](https://unhead.unjs.io/docs/typescript/head/guides/get-started/installation) [Switch to Vue](https://unhead.unjs.io/docs/vue/head/guides/get-started/installation) [Switch to React](https://unhead.unjs.io/docs/react/head/guides/get-started/installation) [Switch to Svelte](https://unhead.unjs.io/docs/svelte/head/guides/get-started/installation) [Switch to Solid.js](https://unhead.unjs.io/docs/solid-js/head/guides/get-started/installation) [Switch to Angular](https://unhead.unjs.io/docs/angular/head/guides/get-started/installation) [Switch to Nuxt](https://unhead.unjs.io/docs/nuxt/head/guides/get-started/installation)

Unhead Principles

## Why Unhead

01

### Complete Developer Experience

- [useHead()](https://unhead.unjs.io/docs/typescript/head/api/composables/use-head) with type narrowing, deduping, and tag merging
- Flat [useSeoMeta()](https://unhead.unjs.io/docs/typescript/head/api/composables/use-seo-meta) for 100+ meta tags
- [useScript()](https://unhead.unjs.io/docs/typescript/head/api/composables/use-script) for performant third party loading
- [useSchemaOrg()](https://unhead.unjs.io/docs/typescript/schema-org/api/composables/use-schema-org) for automatic Schema.org graphs
- Plugins for tag validation, canonical URLs, and 7 more

02

### Built for Performance

- ~4.4kb gzipped, tree shakable utilities
- Built in HTML minification
- [Streaming SSR](https://unhead.unjs.io/releases/v3) with head tags pushed per chunk
- Automatic [Capo.js](https://unhead.unjs.io/learn/guides/what-is-capo) head tag ordering

03

### Any Framework / Any Bundler

- Vue, React, Solid.js, Svelte, and Angular
- Vite, Webpack, Rollup, and more
- Built in [Vite Devtools](https://unhead.unjs.io/docs/head/guides/debugging) integration
- Hook into every stage of head resolution

## Hello useHead()

Unhead aims to provide bullet-proof primitives for a minimal yet powerful API surface.

### ✅ Titles that just work

```
useHead({
  title: 'Hello World',
  titleTemplate: '%s %separator My App',
})
// Hello World - My App
```

### ✅ DOM Events

```
useHead({
  script: [{
    src: '/script.js',
    onload: () => alert('woo'),
  }],
})
```

### ✅ Classes and styles however you like

```
useHead({
  bodyAttrs: {
    // use strings
    style: 'background-color: #343434',
    // arrays
    class: ['dark', 'overflow'],
  },
  htmlAttrs: {
    // objects
    style: {
      backgroundColor: 'white',
      color: 'black',
    },
    // computed boolean objects
    class: {
      dark: () => Date.now() % 2 === 0,
    },
  },
})
```

## Built For Reactive Lifecycles

All side effects are tracked so that unmounting a component will revert its head modifications and reactive updates can be made at any time.

```
useHead({
  title: 'Subscribe now!',
  htmlAttrs: {
    class: { dark: true, light: false }
  },
  bodyAttrs: {
    'style': { overflow: 'hidden' },
    'data-modal': true,
  },
  link: [{
    rel: 'preload',
    href: 'https://3p.com/subscribe.js',
    as: 'script',
  }],
})
```

Mount

Component Not Mounted

## Optimized SEO Tags

Nail your SEO with foolproof flat meta config and the simplest Schema.org you've ever worked with.

### Flat SEO Meta

Was it `<meta property` or `<meta name`? Who can remember, just use `useSeoMeta()`.

```
useSeoMeta({
  ogType: 'article',
  author: 'Harlan Wilton',
  articleAuthor: ['Harlan Wilton'],
  articlePublishedTime: '2024-01-01',
  articleModifiedTime: '2024-01-01',
  twitterData1: 'Harlan Wilton',
  twitterLabel1: 'Author',
  twitterData2: '10 min',
  twitterLabel2: 'Read Time',
})
```

### Schema.org Graphs

Rich result optimized Schema.org graphs without the `application/ld+json`.

```
useSchemaOrg([
  definePerson({
    name: 'Harlan Wilton',
    sameAs: [
      'https://github.com/harlan-zw',
    ],
    url: 'https://harlanzw.com',
  }),
  defineArticle({
    headline: 'Hello World',
    datePublished: '2024-01-01',
  }),
])
```

## Making Websites Faster

Unhead ships to be tree shaken with client and server export paths.

### Optimized Head tag ordering

Unhead ships with a default head tag order that is optimized for SEO and performance.

Enable Capo.js

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

### A `<script>` for full stack javascript

Better developer experience, performance and privacy.

useScript

SSR Output

Client Output

```
const script = useScript({
  src: 'https://js.cdn/tracker.js',
}, {
  trigger: useOnIdle()
})
script.onError((error) => { /* uh oh */ })
// proxy function calls for when the script is loaded
script.proxy.track('foo')
// or just use onLoaded
script.onLoaded((api) => {
  api.track('bar')
})
```

```
<link fetchpriority="low" as="script" crossorigin="anonymous" referrerpolicy="no-referrer" href="https://js.cdn/tracker.js" rel="preload">
```

```
<script data-onload data-onerror defer fetchpriority="low" crossorigin="anonymous" referrerpolicy="no-referrer" src="https://js.cdn/tracker.js">
```

### ✅ Optimized Client Bundles

```
// Unhead tags are built to tree-shake, it just works
if (import.meta.server) {
  useHead({
    meta: [{
      name: 'description',
      content: 'Hello World',
    }],
    script: [{
      innerHTML: 'console.log("Hello World")',
    }],
  })
}
```

## Up To Date. Always.

Unhead was started at the end of 2022 and has received continuous bug fixes and feature improvements from the community.

![GitHub User harlan-zw](https://avatars.githubusercontent.com/u/5326365?v=4)![GitHub User Barbapapazes](https://avatars.githubusercontent.com/u/45267552?v=4)![GitHub User danielroe](https://avatars.githubusercontent.com/u/28706372?v=4)![GitHub User dargmuesli](https://avatars.githubusercontent.com/u/4778485?v=4)![GitHub User huang-julien](https://avatars.githubusercontent.com/u/63512348?v=4)![GitHub User LittleSound](https://avatars.githubusercontent.com/u/19204772?v=4)![GitHub User negezor](https://avatars.githubusercontent.com/u/9392723?v=4)![GitHub User vetruvet](https://avatars.githubusercontent.com/u/149282?v=4)![GitHub User s-en-o](https://avatars.githubusercontent.com/u/4535187?v=4)![GitHub User Narixius](https://avatars.githubusercontent.com/u/16634828?v=4)![GitHub User 719media](https://avatars.githubusercontent.com/u/5942229?v=4)![GitHub User thomasbnt](https://avatars.githubusercontent.com/u/14293805?v=4)![GitHub User atinux](https://avatars.githubusercontent.com/u/904724?v=4)![GitHub User stvnw](https://avatars.githubusercontent.com/u/1736076?v=4)![GitHub User spnc-omz](https://avatars.githubusercontent.com/u/4030177?v=4)![GitHub User Roman3349](https://avatars.githubusercontent.com/u/4655467?v=4)![GitHub User gangsthub](https://avatars.githubusercontent.com/u/202292172?v=4)![GitHub User nozomuikuta](https://avatars.githubusercontent.com/u/16436160?v=4)![GitHub User NikSimonov](https://avatars.githubusercontent.com/u/16648069?v=4)![GitHub User mukundshah](https://avatars.githubusercontent.com/u/39938037?v=4)![GitHub User maximepvrt](https://avatars.githubusercontent.com/u/1840026?v=4)![GitHub User onmax](https://avatars.githubusercontent.com/u/22072217?v=4)![GitHub User TimJohns](https://avatars.githubusercontent.com/u/1420814?v=4)![GitHub User mittalyashu](https://avatars.githubusercontent.com/u/29014463?v=4)![GitHub User amplitudesxd](https://avatars.githubusercontent.com/u/62763456?v=4)![GitHub User kfreezen](https://avatars.githubusercontent.com/u/346924?v=4)![GitHub User nWacky](https://avatars.githubusercontent.com/u/38620459?v=4)![GitHub User reslear](https://avatars.githubusercontent.com/u/12596485?v=4)![GitHub User samenick](https://avatars.githubusercontent.com/u/2915109?v=4)![GitHub User t0yohei](https://avatars.githubusercontent.com/u/30691457?v=4)![GitHub User wckgo](https://avatars.githubusercontent.com/u/33270942?v=4)![GitHub User YunYouJun](https://avatars.githubusercontent.com/u/25154432?v=4)![GitHub User censujiang](https://avatars.githubusercontent.com/u/32415188?v=4)![GitHub User abbassiddiqi](https://avatars.githubusercontent.com/u/3588103?v=4)![GitHub User Mini-ghost](https://avatars.githubusercontent.com/u/39984251?v=4)![GitHub User TheAlexLichter](https://avatars.githubusercontent.com/u/640208?v=4)![GitHub User NyllRE](https://avatars.githubusercontent.com/u/52743522?v=4)![GitHub User paraboul](https://avatars.githubusercontent.com/u/80341?v=4)![GitHub User antfu](https://avatars.githubusercontent.com/u/11247099?v=4)![GitHub User arashsheyda](https://avatars.githubusercontent.com/u/38922203?v=4)![GitHub User bogdanciuca](https://avatars.githubusercontent.com/u/28389201?v=4)![GitHub User TheKicker](https://avatars.githubusercontent.com/u/35354742?v=4)![GitHub User danbars](https://avatars.githubusercontent.com/u/6115771?v=4)![GitHub User daniluk4000](https://avatars.githubusercontent.com/u/10450717?v=4)![GitHub User cybe4sent1nel](https://avatars.githubusercontent.com/u/223209131?v=4)![GitHub User felixranesberger](https://avatars.githubusercontent.com/u/52704891?v=4)![GitHub User imgta](https://avatars.githubusercontent.com/u/126015138?v=4)![GitHub User HigherOrderLogic](https://avatars.githubusercontent.com/u/73709188?v=4)![GitHub User toto6038](https://avatars.githubusercontent.com/u/50100922?v=4)![GitHub User Ingramz](https://avatars.githubusercontent.com/u/1017132?v=4)![GitHub User alcalyn](https://avatars.githubusercontent.com/u/1588144?v=4)![GitHub User kricsleo](https://avatars.githubusercontent.com/u/32707098?v=4)![GitHub User cernymatej](https://avatars.githubusercontent.com/u/112722215?v=4)![GitHub User messenjer](https://avatars.githubusercontent.com/u/80677?v=4)![GitHub User panstromek](https://avatars.githubusercontent.com/u/25121817?v=4)

2.1K

Commits

203

Issues Closed

55

Contributors

250K downloadsper day, on average

Unhead is used and trusted by thousands of developers and companies around the world.

8.5M

Downloads/ month

1212

Total Stars

## Funded by the community

Unhead is completely free and open-source due to the generous support of the community.

[Become a sponsor](https://github.com/sponsors/harlan-zw)

[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/typescript/head/guides/get-started/overview)
- [useHead](https://unhead.unjs.io/docs/typescript/head/api/composables/use-head)
- [useSeoMeta](https://unhead.unjs.io/docs/typescript/head/api/composables/use-seo-meta)
- [useHeadSafe](https://unhead.unjs.io/docs/typescript/head/api/composables/use-head-safe)
- [useScript](https://unhead.unjs.io/docs/typescript/head/api/composables/use-script)

### Schema.org

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

### Guides

- [Titles](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/titles)
- [Streaming SSR](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/streaming)
- [DOM Events](https://unhead.unjs.io/docs/typescript/head/guides/core-concepts/dom-event-handling)
- [Plugins](https://unhead.unjs.io/docs/typescript/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)