@unhead/schema-org 2.0.13 → 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 +150 -4
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -1,9 +1,155 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @unhead/schema-org
|
|
2
2
|
|
|
3
|
-
Schema.org for
|
|
3
|
+
> Unhead Schema.org for Simple and Automated Google Rich Results
|
|
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
|
+
- 🔍 **Google Rich Results** - Automated schema generation for rich search results
|
|
12
|
+
- 🎯 **Type-safe** - Full TypeScript support with schema validation
|
|
13
|
+
- 🖖 **Framework agnostic** - Works with Vue, React, Svelte, SolidJS, and more
|
|
14
|
+
- 📋 **80+ Schema Types** - Support for most common schema.org types
|
|
15
|
+
- ⚡ **Zero runtime** - Generates optimized JSON-LD at build time
|
|
16
|
+
- 🔄 **Reactive** - Dynamic schema updates with framework reactivity
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# npm
|
|
22
|
+
npm install @unhead/schema-org
|
|
23
|
+
|
|
24
|
+
# yarn
|
|
25
|
+
yarn add @unhead/schema-org
|
|
26
|
+
|
|
27
|
+
# pnpm
|
|
28
|
+
pnpm add @unhead/schema-org
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
### Vue
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<script setup>
|
|
37
|
+
import { defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org/vue'
|
|
38
|
+
|
|
39
|
+
useSchemaOrg([
|
|
40
|
+
defineWebSite({
|
|
41
|
+
name: 'My Website',
|
|
42
|
+
url: 'https://example.com',
|
|
43
|
+
}),
|
|
44
|
+
defineWebPage({
|
|
45
|
+
title: 'About Us',
|
|
46
|
+
description: 'Learn more about our company',
|
|
47
|
+
})
|
|
48
|
+
])
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### React
|
|
53
|
+
|
|
54
|
+
```jsx
|
|
55
|
+
import { defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org/react'
|
|
56
|
+
|
|
57
|
+
function About() {
|
|
58
|
+
useSchemaOrg([
|
|
59
|
+
defineWebSite({
|
|
60
|
+
name: 'My Website',
|
|
61
|
+
url: 'https://example.com',
|
|
62
|
+
}),
|
|
63
|
+
defineWebPage({
|
|
64
|
+
title: 'About Us',
|
|
65
|
+
description: 'Learn more about our company',
|
|
66
|
+
})
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
return <h1>About Us</h1>
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Framework Agnostic
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { defineWebPage, useSchemaOrg } from '@unhead/schema-org'
|
|
77
|
+
|
|
78
|
+
// Provide your unhead instance
|
|
79
|
+
useSchemaOrg([
|
|
80
|
+
defineWebPage({
|
|
81
|
+
title: 'My Page',
|
|
82
|
+
description: 'Page description'
|
|
83
|
+
})
|
|
84
|
+
], { head: myHeadInstance })
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Common Schema Types
|
|
88
|
+
|
|
89
|
+
### Article
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { defineArticle } from '@unhead/schema-org'
|
|
93
|
+
|
|
94
|
+
defineArticle({
|
|
95
|
+
headline: 'How to use Schema.org',
|
|
96
|
+
description: 'Learn how to implement schema.org',
|
|
97
|
+
author: {
|
|
98
|
+
name: 'John Doe',
|
|
99
|
+
url: 'https://johndoe.com'
|
|
100
|
+
},
|
|
101
|
+
datePublished: '2023-01-01',
|
|
102
|
+
dateModified: '2023-01-15'
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Organization
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { defineOrganization } from '@unhead/schema-org'
|
|
110
|
+
|
|
111
|
+
defineOrganization({
|
|
112
|
+
name: 'My Company',
|
|
113
|
+
url: 'https://mycompany.com',
|
|
114
|
+
logo: 'https://mycompany.com/logo.png',
|
|
115
|
+
sameAs: [
|
|
116
|
+
'https://twitter.com/mycompany',
|
|
117
|
+
'https://linkedin.com/company/mycompany'
|
|
118
|
+
]
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Product
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { defineProduct } from '@unhead/schema-org'
|
|
126
|
+
|
|
127
|
+
defineProduct({
|
|
128
|
+
name: 'Amazing Product',
|
|
129
|
+
description: 'The most amazing product ever',
|
|
130
|
+
image: 'https://example.com/product.jpg',
|
|
131
|
+
offers: {
|
|
132
|
+
price: '29.99',
|
|
133
|
+
priceCurrency: 'USD',
|
|
134
|
+
availability: 'InStock'
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Documentation
|
|
140
|
+
|
|
141
|
+
Visit the [Schema.org documentation](https://unhead.unjs.io/schema-org) for comprehensive guides and all available schema types.
|
|
6
142
|
|
|
7
143
|
## License
|
|
8
144
|
|
|
9
|
-
MIT
|
|
145
|
+
[MIT](./LICENSE)
|
|
146
|
+
|
|
147
|
+
<!-- Badges -->
|
|
148
|
+
[npm-version-src]: https://img.shields.io/npm/v/@unhead/schema-org/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
149
|
+
[npm-version-href]: https://npmjs.com/package/@unhead/schema-org
|
|
150
|
+
|
|
151
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@unhead/schema-org.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
152
|
+
[npm-downloads-href]: https://npmjs.com/package/@unhead/schema-org
|
|
153
|
+
|
|
154
|
+
[license-src]: https://img.shields.io/github/license/unjs/unhead.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
155
|
+
[license-href]: https://github.com/unjs/unhead/blob/main/LICENSE
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/schema-org",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.17",
|
|
5
5
|
"description": "Unhead Schema.org for Simple and Automated Google Rich Results",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"dist"
|
|
72
72
|
],
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@unhead/
|
|
75
|
-
"@unhead/
|
|
76
|
-
"@unhead/
|
|
77
|
-
"@unhead/
|
|
74
|
+
"@unhead/solid-js": "2.0.17",
|
|
75
|
+
"@unhead/svelte": "2.0.17",
|
|
76
|
+
"@unhead/react": "2.0.17",
|
|
77
|
+
"@unhead/vue": "2.0.17"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"@unhead/react": {
|
|
@@ -94,15 +94,15 @@
|
|
|
94
94
|
"defu": "^6.1.4",
|
|
95
95
|
"ohash": "^2.0.11",
|
|
96
96
|
"ufo": "^1.6.1",
|
|
97
|
-
"unhead": "2.0.
|
|
97
|
+
"unhead": "2.0.17"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
|
-
"unplugin-vue-components": "^
|
|
101
|
-
"@unhead/
|
|
102
|
-
"@unhead/
|
|
103
|
-
"@unhead/
|
|
104
|
-
"unhead": "2.0.
|
|
105
|
-
"
|
|
100
|
+
"unplugin-vue-components": "^29.0.0",
|
|
101
|
+
"@unhead/react": "2.0.17",
|
|
102
|
+
"@unhead/solid-js": "2.0.17",
|
|
103
|
+
"@unhead/svelte": "2.0.17",
|
|
104
|
+
"@unhead/vue": "2.0.17",
|
|
105
|
+
"unhead": "2.0.17"
|
|
106
106
|
},
|
|
107
107
|
"build": {
|
|
108
108
|
"external": [
|