unhead 2.0.16 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,113 @@
|
|
|
1
|
-
#
|
|
1
|
+
# unhead
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Full-stack `<head>` manager built for any framework
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
6
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
7
|
+
[![License][license-src]][license-href]
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🚀 Framework agnostic - works with any framework
|
|
12
|
+
- 🔄 Reactive head management
|
|
13
|
+
- 🔍 SEO-friendly with rich meta tag support
|
|
14
|
+
- 🖥️ Server-side rendering support
|
|
15
|
+
- 📦 Lightweight and tree-shakable
|
|
16
|
+
- ⚡ Performance optimized with minimal runtime overhead
|
|
17
|
+
- 🎯 Type-safe with full TypeScript support
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
6
20
|
|
|
7
21
|
```bash
|
|
8
|
-
npm
|
|
22
|
+
# npm
|
|
23
|
+
npm install unhead
|
|
24
|
+
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add unhead
|
|
27
|
+
|
|
28
|
+
# pnpm
|
|
29
|
+
pnpm add unhead
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { createHead, useHead } from 'unhead'
|
|
38
|
+
|
|
39
|
+
// Create a head instance
|
|
40
|
+
const head = createHead()
|
|
41
|
+
|
|
42
|
+
// Use head tags
|
|
43
|
+
useHead({
|
|
44
|
+
title: 'My App',
|
|
45
|
+
meta: [
|
|
46
|
+
{
|
|
47
|
+
name: 'description',
|
|
48
|
+
content: 'My awesome application'
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}, { head })
|
|
9
52
|
```
|
|
10
53
|
|
|
54
|
+
### Server-Side Rendering
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { createHead, renderSSRHead } from 'unhead/server'
|
|
58
|
+
|
|
59
|
+
const head = createHead()
|
|
60
|
+
|
|
61
|
+
// Add head entries
|
|
62
|
+
useHead({
|
|
63
|
+
title: 'SSR App',
|
|
64
|
+
meta: [{ name: 'description', content: 'Server-rendered app' }]
|
|
65
|
+
}, { head })
|
|
66
|
+
|
|
67
|
+
// Render head tags
|
|
68
|
+
const { headTags, bodyTags } = await renderSSRHead(head)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Client-Side Hydration
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { createHead, renderDOMHead } from 'unhead/client'
|
|
75
|
+
|
|
76
|
+
const head = createHead()
|
|
77
|
+
|
|
78
|
+
// Enable DOM rendering
|
|
79
|
+
renderDOMHead(head)
|
|
80
|
+
|
|
81
|
+
// Add reactive head entries
|
|
82
|
+
useHead({
|
|
83
|
+
title: 'Client App'
|
|
84
|
+
}, { head })
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Framework Integrations
|
|
88
|
+
|
|
89
|
+
Unhead provides optimized integrations for popular frameworks:
|
|
90
|
+
|
|
91
|
+
- **Vue**: [`@unhead/vue`](../vue)
|
|
92
|
+
- **React**: [`@unhead/react`](../react)
|
|
93
|
+
- **Angular**: [`@unhead/angular`](../angular)
|
|
94
|
+
- **Svelte**: [`@unhead/svelte`](../svelte)
|
|
95
|
+
- **SolidJS**: [`@unhead/solid-js`](../solid-js)
|
|
96
|
+
|
|
97
|
+
## Documentation
|
|
98
|
+
|
|
99
|
+
Visit the [documentation site](https://unhead.unjs.io/) for comprehensive guides and API references.
|
|
100
|
+
|
|
11
101
|
## License
|
|
12
102
|
|
|
13
|
-
MIT
|
|
103
|
+
[MIT](./LICENSE)
|
|
104
|
+
|
|
105
|
+
<!-- Badges -->
|
|
106
|
+
[npm-version-src]: https://img.shields.io/npm/v/unhead/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
107
|
+
[npm-version-href]: https://npmjs.com/package/unhead
|
|
108
|
+
|
|
109
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/unhead.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
110
|
+
[npm-downloads-href]: https://npmjs.com/package/unhead
|
|
111
|
+
|
|
112
|
+
[license-src]: https://img.shields.io/github/license/unjs/unhead.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
113
|
+
[license-href]: https://github.com/unjs/unhead/blob/main/LICENSE
|