sanity-plugin-seofields 1.6.5 → 1.7.0
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 +355 -79
- package/dist/SeoHealthDashboard-IP5BJ322.cjs +10 -0
- package/dist/{SeoHealthDashboard-D3XU3CUB.cjs.map → SeoHealthDashboard-IP5BJ322.cjs.map} +1 -1
- package/dist/SeoHealthDashboard-PTUEVYZL.js +4 -0
- package/dist/{SeoHealthDashboard-BEZVLLFG.js.map → SeoHealthDashboard-PTUEVYZL.js.map} +1 -1
- package/dist/{SeoHealthTool-4VZMD4TR.cjs → SeoHealthTool-CZZRMWQK.cjs} +4 -4
- package/dist/SeoHealthTool-CZZRMWQK.cjs.map +1 -0
- package/dist/{SeoHealthTool-BSTYAKQS.js → SeoHealthTool-IULT4G25.js} +3 -3
- package/dist/SeoHealthTool-IULT4G25.js.map +1 -0
- package/dist/{chunk-BHIZQLY7.cjs → chunk-5YRH47VQ.cjs} +23 -26
- package/dist/chunk-5YRH47VQ.cjs.map +1 -0
- package/dist/{chunk-BCTPOWXA.cjs → chunk-ARELX3GK.cjs} +131 -111
- package/dist/chunk-ARELX3GK.cjs.map +1 -0
- package/dist/{chunk-HQTYQMP5.js → chunk-AW7OKBQQ.js} +23 -26
- package/dist/chunk-AW7OKBQQ.js.map +1 -0
- package/dist/{chunk-XXA6WCWS.js → chunk-FONJYVF2.js} +22 -4
- package/dist/chunk-FONJYVF2.js.map +1 -0
- package/dist/{chunk-YHXUWGNA.cjs → chunk-GWPOJSGW.cjs} +99 -3
- package/dist/chunk-GWPOJSGW.cjs.map +1 -0
- package/dist/{chunk-KTL6NYNG.js → chunk-HRKRV2X7.js} +98 -4
- package/dist/chunk-HRKRV2X7.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/{component-H52blyfc.d.ts → component-D1sBm6ts.d.cts} +9 -3
- package/dist/{component-CIE6Sy4F.d.cts → component-DQ4KuQQD.d.ts} +9 -3
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -4
- package/dist/index.d.ts +96 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/next.cjs +85 -77
- package/dist/next.d.cts +3 -3
- package/dist/next.d.ts +3 -3
- package/dist/next.js +2 -2
- package/dist/schema/next.cjs +88 -80
- package/dist/schema/next.d.cts +4 -4
- package/dist/schema/next.d.ts +4 -4
- package/dist/schema/next.js +3 -3
- package/dist/schema.cjs +173 -153
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +10 -6
- package/dist/schema.d.ts +10 -6
- package/dist/schema.js +18 -3
- package/dist/schema.js.map +1 -1
- package/dist/{types-BxcJinOf.d.cts → types-9_wbCIi9.d.ts} +20 -2
- package/dist/{types-BtSRRG6C.d.cts → types-B91ena4g.d.cts} +1 -16
- package/dist/{types-BtSRRG6C.d.ts → types-B91ena4g.d.ts} +1 -16
- package/dist/{types-Dp9Pfnt9.d.ts → types-Bb49oRBV.d.cts} +20 -2
- package/dist/{types-CbYb4MsN.d.ts → types-CeBULNFF.d.ts} +1 -1
- package/dist/{types-CyRdIF-3.d.cts → types-_wBLg6RV.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/SeoHealthDashboard-BEZVLLFG.js +0 -4
- package/dist/SeoHealthDashboard-D3XU3CUB.cjs +0 -10
- package/dist/SeoHealthTool-4VZMD4TR.cjs.map +0 -1
- package/dist/SeoHealthTool-BSTYAKQS.js.map +0 -1
- package/dist/chunk-BCTPOWXA.cjs.map +0 -1
- package/dist/chunk-BHIZQLY7.cjs.map +0 -1
- package/dist/chunk-HQTYQMP5.js.map +0 -1
- package/dist/chunk-KTL6NYNG.js.map +0 -1
- package/dist/chunk-XXA6WCWS.js.map +0 -1
- package/dist/chunk-YHXUWGNA.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,23 +1,130 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# sanity-plugin-seofields
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
**The complete SEO toolkit for Sanity Studio.**
|
|
6
|
+
|
|
7
|
+
Manage SEO fields, social previews, robots directives, canonical URLs, Schema.org JSON-LD, and studio-wide SEO health checks — directly inside Sanity Studio v3, v4, or v5.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/sanity-plugin-seofields) [](https://www.npmjs.com/package/sanity-plugin-seofields) [](./LICENSE) [](https://github.com/hardik-143/sanity-plugin-seofields) [](https://www.sanity.io) [](#compatibility)
|
|
10
|
+
|
|
11
|
+
[**Documentation**](https://sanity-plugin-seofields.thehardik.in/docs) • [Quick Start](#quick-start) • [Configuration](#configuration) • [Schema.org](#schemaorg-structured-data) • [CLI](#cli)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Why This Plugin
|
|
7
16
|
|
|
8
|
-
|
|
17
|
+
Most Sanity SEO plugins stop at title and description fields. `sanity-plugin-seofields` gives editors and developers a full SEO workflow — from per-document fields all the way to studio-wide audits.
|
|
9
18
|
|
|
10
|
-
|
|
19
|
+
| Feature | What you get |
|
|
20
|
+
| :--------------------- | :----------------------------------------- |
|
|
21
|
+
| Structured SEO fields | Complete field group for every document |
|
|
22
|
+
| Live SERP preview | See the Google result while editing |
|
|
23
|
+
| Open Graph + X/Twitter | Full social card controls |
|
|
24
|
+
| Robots + canonical | Indexing directives and canonical URLs |
|
|
25
|
+
| Custom meta tags | Reusable `metaTag` / `metaAttribute` types |
|
|
26
|
+
| Schema.org JSON-LD | 39 types for structured data |
|
|
27
|
+
| Next.js helpers | Metadata and script rendering |
|
|
28
|
+
| SEO Health Dashboard | Audit documents across the whole studio |
|
|
29
|
+
| CLI | Setup, reports, and exports |
|
|
11
30
|
|
|
12
|
-
|
|
31
|
+
Use it as a simple field plugin, a structured data system, or a complete SEO operations layer for your Sanity projects.
|
|
13
32
|
|
|
14
33
|
---
|
|
15
34
|
|
|
16
|
-
|
|
35
|
+
## Table of Contents
|
|
36
|
+
|
|
37
|
+
- [Features](#features)
|
|
38
|
+
- [Installation](#installation)
|
|
39
|
+
- [Quick Start](#quick-start)
|
|
40
|
+
- [Registered Schema Types](#registered-schema-types)
|
|
41
|
+
- [Configuration](#configuration)
|
|
42
|
+
- [SEO Health Dashboard](#seo-health-dashboard)
|
|
43
|
+
- [Schema.org Structured Data](#schemaorg-structured-data)
|
|
44
|
+
- [Next.js & React Exports](#nextjs--react-exports)
|
|
45
|
+
- [CLI](#cli)
|
|
46
|
+
- [Package Exports](#package-exports)
|
|
47
|
+
- [Compatibility](#compatibility)
|
|
48
|
+
- [Contributing](#contributing)
|
|
49
|
+
- [License](#license)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
<details open>
|
|
56
|
+
<summary><b>Studio SEO Fields</b></summary>
|
|
57
|
+
|
|
58
|
+
<br />
|
|
59
|
+
|
|
60
|
+
- `seoFields` object type for a complete SEO field group
|
|
61
|
+
- Meta title, meta description, keywords, canonical URL, and meta image fields
|
|
62
|
+
- Open Graph title, description, image, URL, type, and site name
|
|
63
|
+
- X/Twitter Card title, description, image, site, creator, and card type
|
|
64
|
+
- Robots controls for `noindex`, `nofollow`, `noarchive`, `nosnippet`, and related directives
|
|
65
|
+
- Custom meta tags through reusable `metaTag` and `metaAttribute` types
|
|
66
|
+
- Configurable field labels, descriptions, groups, visibility, and per-document behavior
|
|
67
|
+
- Optional live SEO preview inside the Studio field UI
|
|
68
|
+
|
|
69
|
+
</details>
|
|
70
|
+
|
|
71
|
+
<details>
|
|
72
|
+
<summary><b>SEO Health Dashboard</b></summary>
|
|
73
|
+
|
|
74
|
+
<br />
|
|
75
|
+
|
|
76
|
+
- Studio tool for scanning SEO coverage across documents
|
|
77
|
+
- 0–100 scoring per document
|
|
78
|
+
- Missing title, description, image, canonical, robots, and social metadata checks
|
|
79
|
+
- Document-type filters
|
|
80
|
+
- Query customization
|
|
81
|
+
- Optional custom scoring logic
|
|
82
|
+
- CSV and JSON export
|
|
83
|
+
- Direct links back to documents that need work
|
|
84
|
+
- Demo mode for docs, previews, and onboarding
|
|
85
|
+
|
|
86
|
+
</details>
|
|
87
|
+
|
|
88
|
+
<details>
|
|
89
|
+
<summary><b>Schema.org / JSON-LD</b></summary>
|
|
90
|
+
|
|
91
|
+
<br />
|
|
92
|
+
|
|
93
|
+
- 39 Schema.org types as Sanity object schemas
|
|
94
|
+
- Combined Schema.org array field for flexible content modeling
|
|
95
|
+
- Individual schema plugins when you only need specific types
|
|
96
|
+
- Type picker UI for editors
|
|
97
|
+
- React components that render `<script type="application/ld+json">`
|
|
98
|
+
- `buildXJsonLd()` helpers for server-side rendering and custom frameworks
|
|
99
|
+
- Shared primitives for people, organizations, images, ratings, offers, and language fields
|
|
100
|
+
|
|
101
|
+
</details>
|
|
102
|
+
|
|
103
|
+
<details>
|
|
104
|
+
<summary><b>Frontend Helpers</b></summary>
|
|
105
|
+
|
|
106
|
+
<br />
|
|
107
|
+
|
|
108
|
+
- `buildSeoMeta()` for Next.js App Router `generateMetadata()`
|
|
109
|
+
- `<SeoMetaTags />` for framework-agnostic React rendering
|
|
110
|
+
- Schema.org React components for Next.js and other React frameworks
|
|
111
|
+
- Image URL resolver hooks for Sanity asset pipelines
|
|
112
|
+
- Sanitizers for Open Graph type and Twitter Card values
|
|
17
113
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
114
|
+
</details>
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary><b>CLI</b></summary>
|
|
118
|
+
|
|
119
|
+
<br />
|
|
120
|
+
|
|
121
|
+
- Guided setup command
|
|
122
|
+
- Project checks and doctor-style diagnostics
|
|
123
|
+
- SEO data reports
|
|
124
|
+
- JSON and CSV export for audits, backups, and client review
|
|
125
|
+
- Config support via `defineSeoCli()`
|
|
126
|
+
|
|
127
|
+
</details>
|
|
21
128
|
|
|
22
129
|
---
|
|
23
130
|
|
|
@@ -27,9 +134,18 @@ Manage meta tags, Open Graph, Twitter Cards, robots directives, and 38 Schema.or
|
|
|
27
134
|
npm install sanity-plugin-seofields
|
|
28
135
|
```
|
|
29
136
|
|
|
137
|
+
Peer dependencies:
|
|
138
|
+
|
|
139
|
+
```txt
|
|
140
|
+
sanity ^3 || ^4 || ^5
|
|
141
|
+
react ^18 || ^19
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
30
146
|
## Quick Start
|
|
31
147
|
|
|
32
|
-
### 1. Register the
|
|
148
|
+
### 1. Register the Plugin
|
|
33
149
|
|
|
34
150
|
```ts
|
|
35
151
|
// sanity.config.ts
|
|
@@ -37,182 +153,342 @@ import {defineConfig} from 'sanity'
|
|
|
37
153
|
import seofields from 'sanity-plugin-seofields'
|
|
38
154
|
|
|
39
155
|
export default defineConfig({
|
|
156
|
+
// ...
|
|
40
157
|
plugins: [seofields()],
|
|
41
158
|
})
|
|
42
159
|
```
|
|
43
160
|
|
|
44
|
-
### 2. Add SEO
|
|
161
|
+
### 2. Add SEO Fields to a Document
|
|
45
162
|
|
|
46
163
|
```ts
|
|
164
|
+
// schemas/page.ts
|
|
47
165
|
import {defineField, defineType} from 'sanity'
|
|
48
166
|
|
|
49
167
|
export default defineType({
|
|
50
168
|
name: 'page',
|
|
169
|
+
title: 'Page',
|
|
51
170
|
type: 'document',
|
|
52
171
|
fields: [
|
|
53
|
-
defineField({
|
|
54
|
-
|
|
172
|
+
defineField({
|
|
173
|
+
name: 'title',
|
|
174
|
+
type: 'string',
|
|
175
|
+
}),
|
|
176
|
+
defineField({
|
|
177
|
+
name: 'seo',
|
|
178
|
+
title: 'SEO',
|
|
179
|
+
type: 'seoFields',
|
|
180
|
+
}),
|
|
55
181
|
],
|
|
56
182
|
})
|
|
57
183
|
```
|
|
58
184
|
|
|
59
|
-
|
|
185
|
+
> The `seoFields` type is registered automatically by the plugin.
|
|
186
|
+
|
|
187
|
+
### 3. Render SEO Metadata in Next.js
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
// app/[slug]/page.tsx
|
|
191
|
+
import type {Metadata} from 'next'
|
|
192
|
+
import {buildSeoMeta} from 'sanity-plugin-seofields/next'
|
|
193
|
+
|
|
194
|
+
export async function generateMetadata(): Promise<Metadata> {
|
|
195
|
+
const page = await getPage()
|
|
196
|
+
|
|
197
|
+
return buildSeoMeta({
|
|
198
|
+
seo: page.seo,
|
|
199
|
+
baseUrl: 'https://example.com',
|
|
200
|
+
path: `/pages/${page.slug}`,
|
|
201
|
+
defaults: {
|
|
202
|
+
title: page.title,
|
|
203
|
+
description: 'Default site description',
|
|
204
|
+
},
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Full guide: [Frontend integration](https://sanity-plugin-seofields.thehardik.in/docs/frontend-integration)
|
|
60
210
|
|
|
61
211
|
---
|
|
62
212
|
|
|
63
|
-
##
|
|
213
|
+
## Registered Schema Types
|
|
64
214
|
|
|
65
|
-
| Type |
|
|
66
|
-
|
|
|
67
|
-
| `seoFields` | Complete SEO bundle
|
|
68
|
-
| `openGraph` | Open Graph
|
|
69
|
-
| `twitter` | X
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
215
|
+
| Type | Purpose |
|
|
216
|
+
| :-------------- | :--------------------------------------------------------------------------- |
|
|
217
|
+
| `seoFields` | Complete SEO field bundle for document schemas |
|
|
218
|
+
| `openGraph` | Open Graph metadata for Facebook, LinkedIn, Slack, and other social surfaces |
|
|
219
|
+
| `twitter` | X/Twitter Card metadata |
|
|
220
|
+
| `robots` | Indexing and crawling directives |
|
|
221
|
+
| `metaTag` | Custom meta tag container |
|
|
222
|
+
| `metaAttribute` | Single custom meta attribute |
|
|
73
223
|
|
|
74
224
|
---
|
|
75
225
|
|
|
76
226
|
## Configuration
|
|
77
227
|
|
|
78
228
|
```ts
|
|
229
|
+
import seofields from 'sanity-plugin-seofields'
|
|
230
|
+
|
|
79
231
|
seofields({
|
|
80
232
|
seoPreview: true,
|
|
81
233
|
fieldOverrides: {
|
|
82
|
-
title: {
|
|
234
|
+
title: {
|
|
235
|
+
title: 'Meta Title',
|
|
236
|
+
description: 'Recommended length: 50-60 characters.',
|
|
237
|
+
},
|
|
83
238
|
},
|
|
84
|
-
defaultHiddenFields: ['
|
|
239
|
+
defaultHiddenFields: ['twitterSite'],
|
|
85
240
|
fieldVisibility: {
|
|
86
|
-
post: {
|
|
241
|
+
post: {
|
|
242
|
+
hiddenFields: ['openGraphSiteName'],
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
dashboard: {
|
|
246
|
+
enabled: true,
|
|
247
|
+
licenseKey: process.env.SANITY_STUDIO_SEO_LICENSE_KEY,
|
|
87
248
|
},
|
|
88
249
|
})
|
|
89
250
|
```
|
|
90
251
|
|
|
91
|
-
| Option |
|
|
92
|
-
|
|
|
93
|
-
| `seoPreview` |
|
|
94
|
-
| `fieldOverrides` |
|
|
95
|
-
| `defaultHiddenFields` |
|
|
96
|
-
| `fieldVisibility` |
|
|
252
|
+
| Option | Description |
|
|
253
|
+
| :-------------------- | :------------------------------------------------------------------- |
|
|
254
|
+
| `seoPreview` | Enable or disable the live preview shown inside SEO fields |
|
|
255
|
+
| `fieldOverrides` | Customize field titles, descriptions, validation, and field metadata |
|
|
256
|
+
| `defaultHiddenFields` | Hide specific SEO fields globally |
|
|
257
|
+
| `fieldVisibility` | Hide specific SEO fields for specific document types |
|
|
258
|
+
| `fieldGroups` | Customize how fields are grouped in the `seoFields` object |
|
|
259
|
+
| `apiVersion` | Sanity API version used by plugin clients |
|
|
260
|
+
| `dashboard` | Enable and configure the SEO Health Dashboard tool |
|
|
97
261
|
|
|
98
|
-
|
|
262
|
+
Full reference: [Configuration docs](https://sanity-plugin-seofields.thehardik.in/docs/configuration)
|
|
99
263
|
|
|
100
264
|
---
|
|
101
265
|
|
|
102
266
|
## SEO Health Dashboard
|
|
103
267
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
A built-in Studio tool that audits SEO completeness across all your documents at once — scores each document, highlights missing fields, and links directly to what needs fixing. No external tools. No leaving Studio.
|
|
107
|
-
|
|
108
|
-
Requires a free license key — [get yours here](https://sanity-plugin-seofields.thehardik.in/get-license).
|
|
268
|
+
The dashboard is a Studio tool that helps teams find SEO gaps before they ship content.
|
|
109
269
|
|
|
110
270
|
```ts
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
271
|
+
// sanity.config.ts
|
|
272
|
+
import {defineConfig} from 'sanity'
|
|
273
|
+
import seofields from 'sanity-plugin-seofields'
|
|
274
|
+
|
|
275
|
+
export default defineConfig({
|
|
276
|
+
plugins: [
|
|
277
|
+
seofields({
|
|
278
|
+
dashboard: {
|
|
279
|
+
enabled: true,
|
|
280
|
+
licenseKey: process.env.SANITY_STUDIO_SEO_LICENSE_KEY,
|
|
281
|
+
query: {
|
|
282
|
+
types: ['page', 'post', 'product'],
|
|
283
|
+
},
|
|
284
|
+
export: {
|
|
285
|
+
enabled: true,
|
|
286
|
+
formats: ['csv', 'json'],
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
}),
|
|
290
|
+
],
|
|
116
291
|
})
|
|
117
292
|
```
|
|
118
293
|
|
|
119
|
-
|
|
294
|
+
Dashboard capabilities:
|
|
295
|
+
|
|
296
|
+
- Audit all configured document types
|
|
297
|
+
- View SEO score, status, and missing fields
|
|
298
|
+
- Filter documents by score and document type
|
|
299
|
+
- Export reports as CSV or JSON
|
|
300
|
+
- Open the exact document that needs updates
|
|
301
|
+
- Customize document title, subtitle, and preview display
|
|
302
|
+
|
|
303
|
+
Get a dashboard license: [Get license](https://sanity-plugin-seofields.thehardik.in/get-license)
|
|
304
|
+
|
|
305
|
+
Dashboard docs: [SEO Health Dashboard](https://sanity-plugin-seofields.thehardik.in/docs/dashboard)
|
|
120
306
|
|
|
121
307
|
---
|
|
122
308
|
|
|
123
|
-
## Schema.org
|
|
309
|
+
## Schema.org Structured Data
|
|
124
310
|
|
|
125
|
-
|
|
311
|
+
<details open>
|
|
312
|
+
<summary><b>Register all Schema.org types</b></summary>
|
|
126
313
|
|
|
127
|
-
|
|
314
|
+
<br />
|
|
128
315
|
|
|
129
316
|
```ts
|
|
130
317
|
// sanity.config.ts
|
|
318
|
+
import {defineConfig} from 'sanity'
|
|
319
|
+
import seofields from 'sanity-plugin-seofields'
|
|
131
320
|
import {schemaOrg} from 'sanity-plugin-seofields/schema'
|
|
132
321
|
|
|
133
322
|
export default defineConfig({
|
|
134
|
-
plugins: [seofields(), schemaOrg()],
|
|
323
|
+
plugins: [seofields(), schemaOrg()],
|
|
135
324
|
})
|
|
136
325
|
```
|
|
137
326
|
|
|
138
|
-
|
|
327
|
+
</details>
|
|
328
|
+
|
|
329
|
+
<details>
|
|
330
|
+
<summary><b>Register only the types you need</b></summary>
|
|
331
|
+
|
|
332
|
+
<br />
|
|
139
333
|
|
|
140
334
|
```ts
|
|
141
|
-
import {
|
|
335
|
+
import {
|
|
336
|
+
schemaOrgArticlePlugin,
|
|
337
|
+
schemaOrgFAQPagePlugin,
|
|
338
|
+
schemaOrgProductPlugin,
|
|
339
|
+
} from 'sanity-plugin-seofields/schema'
|
|
142
340
|
|
|
143
341
|
export default defineConfig({
|
|
144
|
-
plugins: [
|
|
342
|
+
plugins: [schemaOrgArticlePlugin(), schemaOrgFAQPagePlugin(), schemaOrgProductPlugin()],
|
|
145
343
|
})
|
|
146
344
|
```
|
|
147
345
|
|
|
148
|
-
|
|
346
|
+
</details>
|
|
347
|
+
|
|
348
|
+
<details>
|
|
349
|
+
<summary><b>Add Schema.org fields to a document</b></summary>
|
|
350
|
+
|
|
351
|
+
<br />
|
|
149
352
|
|
|
150
353
|
```ts
|
|
151
|
-
defineField
|
|
152
|
-
|
|
153
|
-
|
|
354
|
+
import {defineField, defineType} from 'sanity'
|
|
355
|
+
|
|
356
|
+
export default defineType({
|
|
357
|
+
name: 'article',
|
|
358
|
+
type: 'document',
|
|
359
|
+
fields: [
|
|
360
|
+
defineField({
|
|
361
|
+
name: 'schemaOrg',
|
|
362
|
+
title: 'Structured Data',
|
|
363
|
+
type: 'schemaOrg',
|
|
364
|
+
}),
|
|
365
|
+
],
|
|
366
|
+
})
|
|
154
367
|
```
|
|
155
368
|
|
|
156
|
-
|
|
369
|
+
</details>
|
|
370
|
+
|
|
371
|
+
<details>
|
|
372
|
+
<summary><b>Render JSON-LD on the frontend</b></summary>
|
|
373
|
+
|
|
374
|
+
<br />
|
|
157
375
|
|
|
158
376
|
```tsx
|
|
159
|
-
// Combined renderer
|
|
160
377
|
import {SchemaOrgScripts} from 'sanity-plugin-seofields/schema/next'
|
|
161
378
|
|
|
162
|
-
export
|
|
163
|
-
return <SchemaOrgScripts items={
|
|
379
|
+
export function Page({page}: {page: PageData}) {
|
|
380
|
+
return <SchemaOrgScripts items={page.schemaOrg} />
|
|
164
381
|
}
|
|
382
|
+
```
|
|
165
383
|
|
|
166
|
-
|
|
167
|
-
import {ArticleSchema, OrganizationSchema} from 'sanity-plugin-seofields/schema/next'
|
|
384
|
+
Render individual types:
|
|
168
385
|
|
|
169
|
-
|
|
386
|
+
```tsx
|
|
387
|
+
import {ArticleSchema, FAQPageSchema, ProductSchema} from 'sanity-plugin-seofields/schema/next'
|
|
388
|
+
|
|
389
|
+
export function Page({page}: {page: PageData}) {
|
|
170
390
|
return (
|
|
171
391
|
<>
|
|
172
|
-
<ArticleSchema data={
|
|
173
|
-
<
|
|
392
|
+
<ArticleSchema data={page.articleSchema} />
|
|
393
|
+
<FAQPageSchema data={page.faqSchema} />
|
|
394
|
+
<ProductSchema data={page.productSchema} />
|
|
174
395
|
</>
|
|
175
396
|
)
|
|
176
397
|
}
|
|
177
398
|
```
|
|
178
399
|
|
|
179
|
-
|
|
400
|
+
</details>
|
|
401
|
+
|
|
402
|
+
<br />
|
|
403
|
+
|
|
404
|
+
**Available Schema.org types** (39)
|
|
180
405
|
|
|
181
|
-
|
|
406
|
+
`AggregateRating` · `Article` · `BlogPosting` · `Book` · `Brand` · `BreadcrumbList` · `ContactPoint` · `Country` · `Course` · `Event` · `FAQPage` · `HowTo` · `ImageObject` · `ItemList` · `JobPosting` · `LegalService` · `LocalBusiness` · `Movie` · `MusicAlbum` · `MusicRecording` · `NewsArticle` · `Offer` · `OpinionNewsArticle` · `Organization` · `Person` · `Place` · `PostalAddress` · `Product` · `ProfilePage` · `Recipe` · `Restaurant` · `Review` · `Service` · `SocialMediaPosting` · `SoftwareApplication` · `VideoObject` · `WebApplication` · `WebPage` · `Website`
|
|
407
|
+
|
|
408
|
+
Schema.org docs: [Structured data guide](https://sanity-plugin-seofields.thehardik.in/docs/schema-org)
|
|
182
409
|
|
|
183
410
|
---
|
|
184
411
|
|
|
185
|
-
## Next.js
|
|
412
|
+
## Next.js & React Exports
|
|
186
413
|
|
|
187
414
|
```ts
|
|
188
|
-
import {
|
|
415
|
+
import {
|
|
416
|
+
buildSeoMeta,
|
|
417
|
+
SeoMetaTags,
|
|
418
|
+
sanitizeOGType,
|
|
419
|
+
sanitizeTwitterCard,
|
|
420
|
+
} from 'sanity-plugin-seofields/next'
|
|
189
421
|
```
|
|
190
422
|
|
|
191
|
-
|
|
423
|
+
Common usage:
|
|
424
|
+
|
|
425
|
+
- Use `buildSeoMeta()` in Next.js App Router `generateMetadata()`
|
|
426
|
+
- Use `<SeoMetaTags />` in React layouts or frameworks where you control the `<head>`
|
|
427
|
+
- Use `SchemaOrgScripts` or individual schema components for JSON-LD
|
|
428
|
+
- Pass an `imageUrlResolver` when your Sanity image data needs URL building
|
|
429
|
+
|
|
430
|
+
Docs: [Frontend integration](https://sanity-plugin-seofields.thehardik.in/docs/frontend-integration)
|
|
192
431
|
|
|
193
432
|
---
|
|
194
433
|
|
|
195
434
|
## CLI
|
|
196
435
|
|
|
436
|
+
Run the CLI:
|
|
437
|
+
|
|
197
438
|
```bash
|
|
198
439
|
npx seofields
|
|
199
440
|
```
|
|
200
441
|
|
|
201
|
-
|
|
442
|
+
Useful commands:
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
npx seofields init # Guided setup
|
|
446
|
+
npx seofields doctor # Diagnostics
|
|
447
|
+
npx seofields report # SEO data report
|
|
448
|
+
npx seofields export --format json --output seo-report.json # JSON export
|
|
449
|
+
npx seofields export --format csv --output seo-report.csv # CSV export
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
CLI docs: [CLI guide](https://sanity-plugin-seofields.thehardik.in/docs/cli)
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## Package Exports
|
|
457
|
+
|
|
458
|
+
| Import path | Use |
|
|
459
|
+
| :------------------------------------ | :--------------------------------------------------------------------- |
|
|
460
|
+
| `sanity-plugin-seofields` | Studio plugin, base schema types, dashboard pane factory, shared types |
|
|
461
|
+
| `sanity-plugin-seofields/next` | SEO metadata helpers and Schema.org React components |
|
|
462
|
+
| `sanity-plugin-seofields/schema` | Schema.org Sanity schema plugins and type exports |
|
|
463
|
+
| `sanity-plugin-seofields/schema/next` | Schema.org React JSON-LD components |
|
|
464
|
+
| `sanity-plugin-seofields/define-cli` | CLI configuration helper |
|
|
202
465
|
|
|
203
466
|
---
|
|
204
467
|
|
|
205
|
-
##
|
|
468
|
+
## Compatibility
|
|
206
469
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
470
|
+
| Runtime | Supported |
|
|
471
|
+
| :------------ | :------------------------ |
|
|
472
|
+
| Node.js | `>=18` |
|
|
473
|
+
| Sanity Studio | `^3`, `^4`, `^5` |
|
|
474
|
+
| React | `^18`, `^19` |
|
|
475
|
+
| Module format | ESM and CommonJS builds |
|
|
476
|
+
| TypeScript | Type definitions included |
|
|
477
|
+
|
|
478
|
+
---
|
|
211
479
|
|
|
212
480
|
## Contributing
|
|
213
481
|
|
|
214
|
-
|
|
482
|
+
Issues and pull requests are welcome.
|
|
483
|
+
|
|
484
|
+
- [GitHub repository](https://github.com/hardik-143/sanity-plugin-seofields)
|
|
485
|
+
- [Open an issue](https://github.com/hardik-143/sanity-plugin-seofields/issues)
|
|
486
|
+
- [Contributing guide](./CONTRIBUTING.md)
|
|
487
|
+
|
|
488
|
+
If the plugin helps your project, consider leaving a star on the [GitHub repo](https://github.com/hardik-143/sanity-plugin-seofields), a review on the [docs site](https://sanity-plugin-seofields.thehardik.in/reviews), or a rating in the [Sanity Plugin Directory](https://www.sanity.io/plugins/sanity-plugin-seofields).
|
|
489
|
+
|
|
490
|
+
---
|
|
215
491
|
|
|
216
492
|
## License
|
|
217
493
|
|
|
218
|
-
[MIT](./LICENSE)
|
|
494
|
+
[MIT](./LICENSE) © [Hardik Desai](https://github.com/hardik-143)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5YRH47VQ_cjs = require('./chunk-5YRH47VQ.cjs');
|
|
4
|
+
require('./chunk-S367Y35J.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
module.exports = chunk5YRH47VQ_cjs.SeoHealthDashboard_default;
|
|
9
|
+
//# sourceMappingURL=SeoHealthDashboard-IP5BJ322.cjs.map
|
|
10
|
+
//# sourceMappingURL=SeoHealthDashboard-IP5BJ322.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"SeoHealthDashboard-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"SeoHealthDashboard-IP5BJ322.cjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"SeoHealthDashboard-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"SeoHealthDashboard-PTUEVYZL.js"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5YRH47VQ_cjs = require('./chunk-5YRH47VQ.cjs');
|
|
4
4
|
var chunkS367Y35J_cjs = require('./chunk-S367Y35J.cjs');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
7
|
var SeoHealthTool = (props) => {
|
|
8
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunk5YRH47VQ_cjs.SeoHealthDashboard_default, chunkS367Y35J_cjs.__spreadValues({}, props));
|
|
9
9
|
};
|
|
10
10
|
var SeoHealthTool_default = SeoHealthTool;
|
|
11
11
|
|
|
12
12
|
module.exports = SeoHealthTool_default;
|
|
13
|
-
//# sourceMappingURL=SeoHealthTool-
|
|
14
|
-
//# sourceMappingURL=SeoHealthTool-
|
|
13
|
+
//# sourceMappingURL=SeoHealthTool-CZZRMWQK.cjs.map
|
|
14
|
+
//# sourceMappingURL=SeoHealthTool-CZZRMWQK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../npm-pro/src/components/SeoHealthTool.tsx"],"names":["jsx","SeoHealthDashboard_default"],"mappings":";;;;;;AAMA,IAAM,aAAA,GAAgB,CAAC,KAAA,KAAmC;AACxD,EAAA,uBAAOA,cAAA,CAACC,mFAAuB,KAAA,CAAO,CAAA;AACxC,CAAA;AAEA,IAAO,qBAAA,GAAQ","file":"SeoHealthTool-CZZRMWQK.cjs","sourcesContent":["import SeoHealthDashboard, {SeoHealthDashboardProps} from './SeoHealthDashboard'\n\n/**\n * Sanity Tool component for the SEO Health Dashboard\n * This component wraps the SeoHealthDashboard for use as a custom tool in Sanity Studio\n */\nconst SeoHealthTool = (props: SeoHealthDashboardProps) => {\n return <SeoHealthDashboard {...props} />\n}\n\nexport default SeoHealthTool\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SeoHealthDashboard_default } from './chunk-
|
|
1
|
+
import { SeoHealthDashboard_default } from './chunk-AW7OKBQQ.js';
|
|
2
2
|
import { __spreadValues } from './chunk-2NMEKWO5.js';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -8,5 +8,5 @@ var SeoHealthTool = (props) => {
|
|
|
8
8
|
var SeoHealthTool_default = SeoHealthTool;
|
|
9
9
|
|
|
10
10
|
export { SeoHealthTool_default as default };
|
|
11
|
-
//# sourceMappingURL=SeoHealthTool-
|
|
12
|
-
//# sourceMappingURL=SeoHealthTool-
|
|
11
|
+
//# sourceMappingURL=SeoHealthTool-IULT4G25.js.map
|
|
12
|
+
//# sourceMappingURL=SeoHealthTool-IULT4G25.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../npm-pro/src/components/SeoHealthTool.tsx"],"names":[],"mappings":";;;;AAMA,IAAM,aAAA,GAAgB,CAAC,KAAA,KAAmC;AACxD,EAAA,uBAAO,GAAA,CAAC,+CAAuB,KAAA,CAAO,CAAA;AACxC,CAAA;AAEA,IAAO,qBAAA,GAAQ","file":"SeoHealthTool-IULT4G25.js","sourcesContent":["import SeoHealthDashboard, {SeoHealthDashboardProps} from './SeoHealthDashboard'\n\n/**\n * Sanity Tool component for the SEO Health Dashboard\n * This component wraps the SeoHealthDashboard for use as a custom tool in Sanity Studio\n */\nconst SeoHealthTool = (props: SeoHealthDashboardProps) => {\n return <SeoHealthDashboard {...props} />\n}\n\nexport default SeoHealthTool\n"]}
|