sanity-plugin-seofields 1.2.5 → 1.2.7
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 +465 -0
- package/dist/index.cjs +2604 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +422 -0
- package/dist/index.d.ts +339 -492
- package/dist/index.js +1284 -2013
- package/dist/index.js.map +1 -1
- package/dist/next.cjs +182 -0
- package/dist/next.cjs.map +1 -0
- package/dist/next.d.cts +241 -0
- package/dist/next.d.ts +202 -295
- package/dist/next.js +110 -70
- package/dist/next.js.map +1 -1
- package/dist/types-B91ena4g.d.cts +89 -0
- package/dist/types-B91ena4g.d.ts +89 -0
- package/package.json +46 -20
- package/dist/index.d.mts +0 -575
- package/dist/index.mjs +0 -3292
- package/dist/index.mjs.map +0 -1
- package/dist/next.d.mts +0 -334
- package/dist/next.mjs +0 -102
- package/dist/next.mjs.map +0 -1
- package/sanity.json +0 -8
- package/src/components/SeoHealthDashboard.tsx +0 -1568
- package/src/components/SeoHealthPane.tsx +0 -81
- package/src/components/SeoHealthTool.tsx +0 -11
- package/src/components/SeoPreview.tsx +0 -178
- package/src/components/meta/MetaDescription.tsx +0 -39
- package/src/components/meta/MetaTitle.tsx +0 -44
- package/src/components/openGraph/OgDescription.tsx +0 -46
- package/src/components/openGraph/OgTitle.tsx +0 -45
- package/src/components/twitter/twitterDescription.tsx +0 -45
- package/src/components/twitter/twitterTitle.tsx +0 -45
- package/src/helpers/SeoMetaTags.tsx +0 -154
- package/src/helpers/seoMeta.ts +0 -283
- package/src/index.ts +0 -26
- package/src/next.ts +0 -12
- package/src/plugin.ts +0 -344
- package/src/schemas/index.ts +0 -121
- package/src/schemas/types/index.ts +0 -20
- package/src/schemas/types/metaAttribute/index.ts +0 -60
- package/src/schemas/types/metaTag/index.ts +0 -17
- package/src/schemas/types/openGraph/index.ts +0 -114
- package/src/schemas/types/robots/index.ts +0 -26
- package/src/schemas/types/twitter/index.ts +0 -108
- package/src/types.ts +0 -108
- package/src/utils/fieldsUtils.ts +0 -160
- package/src/utils/seoUtils.ts +0 -423
- package/src/utils/utils.ts +0 -9
- package/v2-incompatible.js +0 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,306 +1,139 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export declare function allSchemas(config?: SeoFieldsPluginConfig): SchemaTypeDefinition[]
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Creates a desk-structure pane for the SEO Health Dashboard.
|
|
16
|
-
*
|
|
17
|
-
* Returns a **`ComponentBuilder`** with a built-in `.child()` resolver so that
|
|
18
|
-
* clicking any document row opens the document editor as a split pane to the right.
|
|
19
|
-
*
|
|
20
|
-
* Use it **directly** as the `.child()` value — do **not** wrap it in `S.component()`.
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* // sanity.config.ts
|
|
24
|
-
* structure: (S) =>
|
|
25
|
-
* S.list().items([
|
|
26
|
-
* S.listItem()
|
|
27
|
-
* .title('SEO Health')
|
|
28
|
-
* .child(
|
|
29
|
-
* createSeoHealthPane(S, {
|
|
30
|
-
* licenseKey: 'SEOF-XXXX-XXXX-XXXX',
|
|
31
|
-
* query: `*[_type == "post" && defined(seo)]{ _id, _type, title, slug, seo, _updatedAt }`,
|
|
32
|
-
* })
|
|
33
|
-
* ),
|
|
34
|
-
* ])
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function createSeoHealthPane(
|
|
38
|
-
optionsOrS: StructureBuilder,
|
|
39
|
-
optionsWhenS: SeoHealthPaneOptions,
|
|
40
|
-
): ComponentBuilder
|
|
41
|
-
|
|
42
|
-
export declare interface DocumentWithSeoHealth {
|
|
43
|
-
_id: string
|
|
44
|
-
_type: string
|
|
45
|
-
title?: string
|
|
46
|
-
slug?: {
|
|
47
|
-
current: string
|
|
48
|
-
}
|
|
49
|
-
seo?: SeoFields
|
|
50
|
-
_updatedAt?: string
|
|
51
|
-
health: SeoHealthMetrics
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export declare interface FieldVisibilityConfig {
|
|
55
|
-
hiddenFields?: ValidHiddenFieldKeys[]
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
declare interface MetaAttribute {
|
|
59
|
-
_type: 'metaAttribute'
|
|
60
|
-
key?: string
|
|
61
|
-
type?: 'string' | 'image'
|
|
62
|
-
value?: string
|
|
63
|
-
image?: SanityImage
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export declare const metaAttributeSchema: {
|
|
67
|
-
type: 'object'
|
|
68
|
-
name: 'metaAttribute'
|
|
69
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
70
|
-
preview?:
|
|
71
|
-
| PreviewConfig<
|
|
72
|
-
{
|
|
73
|
-
attributeName: string
|
|
74
|
-
attributeValueString: string
|
|
75
|
-
attributeValueImage: string
|
|
76
|
-
},
|
|
77
|
-
Record<'attributeName' | 'attributeValueString' | 'attributeValueImage', any>
|
|
78
|
-
>
|
|
79
|
-
| undefined
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export declare const metaTagSchema: {
|
|
83
|
-
type: 'object'
|
|
84
|
-
name: 'metaTag'
|
|
85
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
86
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export declare type openGraphFieldKeys =
|
|
90
|
-
| 'openGraphUrl'
|
|
91
|
-
| 'openGraphTitle'
|
|
92
|
-
| 'openGraphDescription'
|
|
93
|
-
| 'openGraphSiteName'
|
|
94
|
-
| 'openGraphType'
|
|
95
|
-
| 'openGraphImageType'
|
|
96
|
-
| 'openGraphImage'
|
|
97
|
-
| 'openGraphImageUrl'
|
|
98
|
-
|
|
99
|
-
export declare function openGraphSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
|
|
100
|
-
|
|
101
|
-
declare interface OpenGraphSettings {
|
|
102
|
-
_type: 'openGraph'
|
|
103
|
-
/** The canonical URL for OpenGraph (og:url). Maps to the `url` field in Sanity. */
|
|
104
|
-
url?: string
|
|
105
|
-
title?: string
|
|
106
|
-
description?: string
|
|
107
|
-
siteName?: string
|
|
108
|
-
type?: 'website' | 'article' | 'profile' | 'book' | 'music' | 'video' | 'product'
|
|
109
|
-
imageType?: 'upload' | 'url'
|
|
110
|
-
image?: SanityImageWithAlt
|
|
111
|
-
imageUrl?: string
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export declare const robotsSchema: {
|
|
115
|
-
type: 'object'
|
|
116
|
-
name: 'robots'
|
|
117
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
118
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
declare interface RobotsSettings {
|
|
122
|
-
noIndex?: boolean
|
|
123
|
-
noFollow?: boolean
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
declare interface SanityImage {
|
|
127
|
-
_type: 'image'
|
|
128
|
-
asset: {
|
|
129
|
-
_ref: string
|
|
130
|
-
_type: 'reference'
|
|
131
|
-
}
|
|
132
|
-
hotspot?: {
|
|
133
|
-
x: number
|
|
134
|
-
y: number
|
|
135
|
-
height: number
|
|
136
|
-
width: number
|
|
137
|
-
}
|
|
138
|
-
crop?: {
|
|
139
|
-
top: number
|
|
140
|
-
bottom: number
|
|
141
|
-
left: number
|
|
142
|
-
right: number
|
|
143
|
-
}
|
|
144
|
-
alt?: string
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare interface SanityImageWithAlt extends SanityImage {
|
|
148
|
-
alt: string
|
|
1
|
+
import * as sanity from 'sanity';
|
|
2
|
+
import { SchemaTypeDefinition } from 'sanity';
|
|
3
|
+
import { D as DocumentWithSeoHealth } from './types-B91ena4g.js';
|
|
4
|
+
export { S as SeoHealthMetrics, a as SeoHealthStatus } from './types-B91ena4g.js';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
+
import { StructureBuilder, ComponentBuilder } from 'sanity/structure';
|
|
8
|
+
|
|
9
|
+
interface SeoFieldConfig {
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
149
12
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
| 'title'
|
|
158
|
-
| 'description'
|
|
159
|
-
| 'canonicalUrl'
|
|
160
|
-
| 'metaImage'
|
|
161
|
-
| 'keywords'
|
|
162
|
-
| 'metaAttributes'
|
|
163
|
-
| 'robots'
|
|
164
|
-
|
|
165
|
-
declare interface SeoFields {
|
|
166
|
-
_type: 'seoFields'
|
|
167
|
-
robots?: RobotsSettings
|
|
168
|
-
preview?: string
|
|
169
|
-
title?: string
|
|
170
|
-
description?: string
|
|
171
|
-
metaImage?: SanityImage
|
|
172
|
-
metaAttributes?: MetaAttribute[]
|
|
173
|
-
keywords?: string[]
|
|
174
|
-
canonicalUrl?: string
|
|
175
|
-
openGraph?: OpenGraphSettings
|
|
176
|
-
twitter?: TwitterCardSettings
|
|
13
|
+
type SeoFieldKeys = 'title' | 'description' | 'canonicalUrl' | 'metaImage' | 'keywords' | 'metaAttributes' | 'robots';
|
|
14
|
+
type openGraphFieldKeys = 'openGraphUrl' | 'openGraphTitle' | 'openGraphDescription' | 'openGraphSiteName' | 'openGraphType' | 'openGraphImageType' | 'openGraphImage' | 'openGraphImageUrl';
|
|
15
|
+
type twitterFieldKeys = 'twitterCard' | 'twitterSite' | 'twitterCreator' | 'twitterTitle' | 'twitterDescription' | 'twitterImageType' | 'twitterImage' | 'twitterImageUrl';
|
|
16
|
+
type AllFieldKeys = SeoFieldKeys | openGraphFieldKeys | twitterFieldKeys;
|
|
17
|
+
type ValidHiddenFieldKeys = Exclude<AllFieldKeys, 'openGraphImageUrl' | 'twitterImageUrl' | 'openGraphImageType' | 'twitterImageType'>;
|
|
18
|
+
interface FieldVisibilityConfig {
|
|
19
|
+
hiddenFields?: ValidHiddenFieldKeys[];
|
|
177
20
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
* // Option 2 – provide a full custom GROQ query (takes precedence over `types`)
|
|
247
|
-
* // Must return documents with at least: _id, _type, title, seo, _updatedAt
|
|
248
|
-
* groq: `*[seo != null && defined(slug.current)]{ _id, _type, title, slug, seo, _updatedAt }`,
|
|
249
|
-
* },
|
|
250
|
-
* }
|
|
251
|
-
* ```
|
|
252
|
-
*/
|
|
253
|
-
healthDashboard?:
|
|
254
|
-
| boolean
|
|
255
|
-
| {
|
|
21
|
+
interface SeoFieldsPluginConfig {
|
|
22
|
+
/**
|
|
23
|
+
* Enable or configure the SEO preview feature.
|
|
24
|
+
* If set to `true`, the SEO preview will be enabled with default settings.
|
|
25
|
+
* If set to an object, you can provide a custom prefix function to modify the URL prefix in the preview.
|
|
26
|
+
* The prefix function receives the current document as an argument and should return a string.
|
|
27
|
+
* Example:
|
|
28
|
+
* ```
|
|
29
|
+
* seoPreview: {
|
|
30
|
+
* prefix: (doc) => `/${doc.slug?.current || 'untitled'}`
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
seoPreview?: boolean | {
|
|
35
|
+
prefix?: (doc: {
|
|
36
|
+
_type?: string;
|
|
37
|
+
} & Record<string, unknown>) => string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A mapping of field keys to their configuration settings.
|
|
41
|
+
* This allows customization of field titles and descriptions.
|
|
42
|
+
* For example, to change the title of the 'title' field:
|
|
43
|
+
*/
|
|
44
|
+
fieldOverrides?: Partial<Record<AllFieldKeys, SeoFieldConfig>>;
|
|
45
|
+
/**
|
|
46
|
+
* A mapping of document types to field visibility configurations.
|
|
47
|
+
* This allows you to specify which fields should be hidden for specific document types.
|
|
48
|
+
*/
|
|
49
|
+
fieldVisibility?: Record<string, FieldVisibilityConfig>;
|
|
50
|
+
/**
|
|
51
|
+
* A list of fields that should be hidden by default in all document types.
|
|
52
|
+
* This can be overridden by specific document type settings in `fieldVisibility`.
|
|
53
|
+
*/
|
|
54
|
+
defaultHiddenFields?: ValidHiddenFieldKeys[];
|
|
55
|
+
/**
|
|
56
|
+
* The base URL of your website, used for generating full URLs in the SEO preview.
|
|
57
|
+
* Defaults to 'https://www.example.com' if not provided.
|
|
58
|
+
*/
|
|
59
|
+
baseUrl?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Enable or configure the SEO Health Dashboard tool.
|
|
62
|
+
* If set to `true`, the dashboard is enabled with all defaults.
|
|
63
|
+
* If set to an object, you can customise the tool and dashboard settings.
|
|
64
|
+
* Defaults to `true`.
|
|
65
|
+
* Example:
|
|
66
|
+
* ```
|
|
67
|
+
* healthDashboard: {
|
|
68
|
+
* toolTitle: 'SEO Overview', // Studio nav tab label
|
|
69
|
+
* content: {
|
|
70
|
+
* icon: '🔍', // Emoji icon shown before the page heading
|
|
71
|
+
* title: 'My SEO Dashboard',// Page heading inside the tool (no emoji)
|
|
72
|
+
* description: 'Track SEO across all documents', // Subtitle under the heading
|
|
73
|
+
* },
|
|
74
|
+
* display: {
|
|
75
|
+
* typeColumn: false, // Hide the document type column (default: true)
|
|
76
|
+
* documentId: false, // Hide the document ID under titles (default: true)
|
|
77
|
+
* },
|
|
78
|
+
* query: {
|
|
79
|
+
* // Option 1 – filter by specific document types
|
|
80
|
+
* types: ['post', 'page'],
|
|
81
|
+
* // Option 2 – provide a full custom GROQ query (takes precedence over `types`)
|
|
82
|
+
* // Must return documents with at least: _id, _type, title, seo, _updatedAt
|
|
83
|
+
* groq: `*[seo != null && defined(slug.current)]{ _id, _type, title, slug, seo, _updatedAt }`,
|
|
84
|
+
* },
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
healthDashboard?: boolean | {
|
|
256
89
|
tool?: {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
toolTitle?: string
|
|
90
|
+
title?: string;
|
|
91
|
+
name?: string;
|
|
92
|
+
};
|
|
93
|
+
toolTitle?: string;
|
|
261
94
|
content?: {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
95
|
+
icon?: string;
|
|
96
|
+
title?: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
/** Text shown while the license key is being verified. Defaults to "Verifying license…" */
|
|
99
|
+
loadingLicense?: string;
|
|
100
|
+
/** Text shown while documents are being fetched. Defaults to "Loading documents…" */
|
|
101
|
+
loadingDocuments?: string;
|
|
102
|
+
/** Text shown when the query returns zero results. Defaults to "No documents found" */
|
|
103
|
+
noDocuments?: string;
|
|
104
|
+
};
|
|
272
105
|
display?: {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
106
|
+
typeColumn?: boolean;
|
|
107
|
+
documentId?: boolean;
|
|
108
|
+
};
|
|
276
109
|
query?: {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
110
|
+
/**
|
|
111
|
+
* Limit the dashboard to specific document types.
|
|
112
|
+
* Example: `['post', 'page']`
|
|
113
|
+
*/
|
|
114
|
+
types?: string[];
|
|
115
|
+
/**
|
|
116
|
+
* When using `types`, also require the `seo` field to be non-null.
|
|
117
|
+
* Set to `false` to include documents of those types even if `seo` is missing.
|
|
118
|
+
* Defaults to `true`.
|
|
119
|
+
*/
|
|
120
|
+
requireSeo?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Provide a fully custom GROQ query. Takes precedence over `types`.
|
|
123
|
+
* The query must return documents with at least: _id, _type, title, seo, _updatedAt
|
|
124
|
+
*/
|
|
125
|
+
groq?: string;
|
|
126
|
+
};
|
|
294
127
|
/**
|
|
295
128
|
* The Sanity API version to use for the client (e.g. '2023-01-01').
|
|
296
129
|
* Defaults to '2023-01-01'.
|
|
297
130
|
*/
|
|
298
|
-
apiVersion?: string
|
|
131
|
+
apiVersion?: string;
|
|
299
132
|
/**
|
|
300
133
|
* License key for the SEO Health Dashboard pro feature.
|
|
301
134
|
* Obtain a license at https://sanity-plugin-seofields.thehardik.in
|
|
302
135
|
*/
|
|
303
|
-
licenseKey?: string
|
|
136
|
+
licenseKey?: string;
|
|
304
137
|
/**
|
|
305
138
|
* Map raw `_type` values to human-readable display labels.
|
|
306
139
|
* Used in both the Type column and the Type filter dropdown.
|
|
@@ -309,13 +142,13 @@ export declare interface SeoFieldsPluginConfig {
|
|
|
309
142
|
* @example
|
|
310
143
|
* typeLabels: { productDrug: 'Products', singleCondition: 'Condition' }
|
|
311
144
|
*/
|
|
312
|
-
typeLabels?: Record<string, string
|
|
145
|
+
typeLabels?: Record<string, string>;
|
|
313
146
|
/**
|
|
314
147
|
* Controls how the document type is rendered in the Type column.
|
|
315
148
|
* - `'badge'` (default) — coloured pill
|
|
316
149
|
* - `'text'` — plain text, useful for dense layouts
|
|
317
150
|
*/
|
|
318
|
-
typeColumnMode?: 'badge' | 'text'
|
|
151
|
+
typeColumnMode?: 'badge' | 'text';
|
|
319
152
|
/**
|
|
320
153
|
* The document field to use as the display title in the dashboard.
|
|
321
154
|
*
|
|
@@ -328,7 +161,7 @@ export declare interface SeoFieldsPluginConfig {
|
|
|
328
161
|
* @example
|
|
329
162
|
* titleField: { post: 'title', product: 'name', category: 'label' }
|
|
330
163
|
*/
|
|
331
|
-
titleField?: string | Record<string, string
|
|
164
|
+
titleField?: string | Record<string, string>;
|
|
332
165
|
/**
|
|
333
166
|
* Callback function to render a custom badge next to the document title.
|
|
334
167
|
* Receives the full document and should return badge data or undefined.
|
|
@@ -341,14 +174,12 @@ export declare interface SeoFieldsPluginConfig {
|
|
|
341
174
|
* return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
|
|
342
175
|
* }
|
|
343
176
|
*/
|
|
344
|
-
docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) =>
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
| undefined
|
|
177
|
+
docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
|
|
178
|
+
label: string;
|
|
179
|
+
bgColor?: string;
|
|
180
|
+
textColor?: string;
|
|
181
|
+
fontSize?: string;
|
|
182
|
+
} | undefined;
|
|
352
183
|
/**
|
|
353
184
|
* The `name` of the Sanity structure tool that contains the monitored documents.
|
|
354
185
|
* Required when you have multiple structure tools and the documents live in a
|
|
@@ -358,7 +189,7 @@ export declare interface SeoFieldsPluginConfig {
|
|
|
358
189
|
* @example
|
|
359
190
|
* structureTool: 'common'
|
|
360
191
|
*/
|
|
361
|
-
structureTool?: string
|
|
192
|
+
structureTool?: string;
|
|
362
193
|
/**
|
|
363
194
|
* Enable preview/demo mode to show dummy data.
|
|
364
195
|
* Useful for testing, documentation, or showcasing the dashboard.
|
|
@@ -368,151 +199,180 @@ export declare interface SeoFieldsPluginConfig {
|
|
|
368
199
|
* @example
|
|
369
200
|
* previewMode: true
|
|
370
201
|
*/
|
|
371
|
-
previewMode?: boolean
|
|
372
|
-
|
|
202
|
+
previewMode?: boolean;
|
|
203
|
+
};
|
|
373
204
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
205
|
+
declare const seofields: sanity.Plugin<void | SeoFieldsPluginConfig>;
|
|
206
|
+
|
|
207
|
+
declare function seoFieldsSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition;
|
|
208
|
+
|
|
209
|
+
declare function types(config?: SeoFieldsPluginConfig): SchemaTypeDefinition[];
|
|
210
|
+
|
|
211
|
+
declare const _default$2: {
|
|
212
|
+
type: "object";
|
|
213
|
+
name: "metaAttribute";
|
|
214
|
+
} & Omit<sanity.ObjectDefinition, "preview"> & {
|
|
215
|
+
preview?: sanity.PreviewConfig<{
|
|
216
|
+
attributeName: string;
|
|
217
|
+
attributeValueString: string;
|
|
218
|
+
attributeValueImage: string;
|
|
219
|
+
}, Record<"attributeName" | "attributeValueString" | "attributeValueImage", any>> | undefined;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
declare const _default$1: {
|
|
223
|
+
type: "object";
|
|
224
|
+
name: "metaTag";
|
|
225
|
+
} & Omit<sanity.ObjectDefinition, "preview"> & {
|
|
226
|
+
preview?: sanity.PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
declare function openGraph(config?: SeoFieldsPluginConfig): SchemaTypeDefinition;
|
|
230
|
+
|
|
231
|
+
declare const _default: {
|
|
232
|
+
type: "object";
|
|
233
|
+
name: "robots";
|
|
234
|
+
} & Omit<sanity.ObjectDefinition, "preview"> & {
|
|
235
|
+
preview?: sanity.PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
declare function twitter(config?: SeoFieldsPluginConfig): SchemaTypeDefinition;
|
|
239
|
+
|
|
240
|
+
interface SeoHealthDashboardProps {
|
|
241
|
+
icon?: string;
|
|
242
|
+
title?: string;
|
|
243
|
+
description?: string;
|
|
244
|
+
showTypeColumn?: boolean;
|
|
245
|
+
showDocumentId?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Limit the dashboard to specific document type names.
|
|
248
|
+
* If both queryTypes and customQuery are provided, customQuery takes precedence.
|
|
249
|
+
*/
|
|
250
|
+
queryTypes?: string[];
|
|
251
|
+
/**
|
|
252
|
+
* When using `queryTypes`, also filter by `seo != null`.
|
|
253
|
+
* Set to `false` to include documents of those types even without an seo field.
|
|
254
|
+
* Defaults to `true`.
|
|
255
|
+
*/
|
|
256
|
+
queryRequireSeo?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* A fully custom GROQ query used to fetch documents.
|
|
259
|
+
* Must return objects with at least: _id, _type, title, seo, _updatedAt
|
|
260
|
+
* Takes precedence over queryTypes.
|
|
261
|
+
*/
|
|
262
|
+
customQuery?: string;
|
|
263
|
+
/**
|
|
264
|
+
* The Sanity API version to use for the client (e.g. '2023-01-01').
|
|
265
|
+
* Defaults to '2023-01-01'.
|
|
266
|
+
*/
|
|
267
|
+
apiVersion?: string;
|
|
268
|
+
/**
|
|
269
|
+
* License key for the SEO Health Dashboard.
|
|
270
|
+
* Obtain a key at https://sanity-plugin-seofields.thehardik.in
|
|
271
|
+
*/
|
|
272
|
+
licenseKey?: string;
|
|
273
|
+
/**
|
|
274
|
+
* Map raw `_type` values to human-readable display labels used in the
|
|
275
|
+
* Type column and the Type filter dropdown.
|
|
276
|
+
* Any type without an entry falls back to the raw `_type` string.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* typeLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
|
|
280
|
+
*/
|
|
281
|
+
typeLabels?: Record<string, string>;
|
|
282
|
+
/**
|
|
283
|
+
* Controls how the type is rendered in the Type column.
|
|
284
|
+
* - `'badge'` (default) — coloured pill, consistent with score badges
|
|
285
|
+
* - `'text'` — plain text, useful for dense layouts
|
|
286
|
+
*/
|
|
287
|
+
typeColumnMode?: 'badge' | 'text';
|
|
288
|
+
/**
|
|
289
|
+
* The document field to use as the display title.
|
|
290
|
+
*
|
|
291
|
+
* - `string` — use this field for every document type (e.g. `'name'`)
|
|
292
|
+
* - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* // Same field for all types
|
|
296
|
+
* titleField: 'name'
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* // Different field per type
|
|
300
|
+
* titleField: { post: 'title', product: 'name', category: 'label' }
|
|
301
|
+
*/
|
|
302
|
+
titleField?: string | Record<string, string>;
|
|
303
|
+
/**
|
|
304
|
+
* Callback function to render a custom badge next to the document title.
|
|
305
|
+
* Receives the full document and should return badge data or undefined.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* docBadge: (doc) => {
|
|
309
|
+
* if (doc.services === 'NHS')
|
|
310
|
+
* return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
|
|
311
|
+
* if (doc.services === 'Private')
|
|
312
|
+
* return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
|
|
313
|
+
* }
|
|
314
|
+
*/
|
|
315
|
+
docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
|
|
316
|
+
label: string;
|
|
317
|
+
bgColor?: string;
|
|
318
|
+
textColor?: string;
|
|
319
|
+
fontSize?: string;
|
|
320
|
+
} | undefined;
|
|
321
|
+
/**
|
|
322
|
+
* Custom text shown while the license key is being verified.
|
|
323
|
+
* Defaults to `"Verifying license…"`.
|
|
324
|
+
*/
|
|
325
|
+
loadingLicense?: React.ReactNode;
|
|
326
|
+
/**
|
|
327
|
+
* Custom text shown while documents are being fetched.
|
|
328
|
+
* Defaults to `"Loading documents…"`.
|
|
329
|
+
*/
|
|
330
|
+
loadingDocuments?: React.ReactNode;
|
|
331
|
+
/**
|
|
332
|
+
* Custom text shown when the query returns zero results.
|
|
333
|
+
* Defaults to `"No documents found"`.
|
|
334
|
+
*/
|
|
335
|
+
noDocuments?: React.ReactNode;
|
|
336
|
+
/**
|
|
337
|
+
* Enable preview/demo mode to show dummy data.
|
|
338
|
+
* Useful for testing, documentation, or showcasing the dashboard.
|
|
339
|
+
* When enabled, displays realistic sample documents with various SEO scores.
|
|
340
|
+
* Defaults to `false`.
|
|
341
|
+
*/
|
|
342
|
+
previewMode?: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* When `true`, clicking a document title opens the document editor as a split
|
|
345
|
+
* pane to the right, keeping the SEO Health pane visible on the left.
|
|
346
|
+
* This uses Sanity's pane router and requires the component to be rendered
|
|
347
|
+
* inside a desk-structure pane context (i.e. via `createSeoHealthPane`).
|
|
348
|
+
*
|
|
349
|
+
* When `false` (default), clicking navigates to the document via the standard
|
|
350
|
+
* intent-link system (full navigation).
|
|
351
|
+
*
|
|
352
|
+
* This is set to `true` automatically by `createSeoHealthPane`.
|
|
353
|
+
*/
|
|
354
|
+
openInPane?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* The `name` of the Sanity structure tool that contains the monitored documents.
|
|
357
|
+
* When provided, clicking a document title navigates directly to that tool's
|
|
358
|
+
* intent URL (`/{basePath}/{structureTool}/intent/edit/id=…;type=…/`) instead of
|
|
359
|
+
* using the generic intent resolver, which always picks the first registered tool.
|
|
360
|
+
*
|
|
361
|
+
* Required when you have multiple structure tools and the documents live in a
|
|
362
|
+
* non-default one (e.g. `name: 'common'`).
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* structureTool: 'common'
|
|
366
|
+
*/
|
|
367
|
+
structureTool?: string;
|
|
509
368
|
}
|
|
369
|
+
declare const SeoHealthDashboard: React.FC<SeoHealthDashboardProps>;
|
|
510
370
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Sanity Tool component for the SEO Health Dashboard
|
|
373
|
+
* This component wraps the SeoHealthDashboard for use as a custom tool in Sanity Studio
|
|
374
|
+
*/
|
|
375
|
+
declare const SeoHealthTool: (props: SeoHealthDashboardProps) => react_jsx_runtime.JSX.Element;
|
|
516
376
|
|
|
517
377
|
/**
|
|
518
378
|
* Options accepted by `createSeoHealthPane`.
|
|
@@ -520,56 +380,43 @@ export declare interface SeoHealthMetrics {
|
|
|
520
380
|
*
|
|
521
381
|
* `licenseKey` is **required** — the dashboard will not render without it.
|
|
522
382
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
383
|
+
interface SeoHealthPaneOptions extends Omit<SeoHealthDashboardProps, 'customQuery'> {
|
|
384
|
+
/** Required license key (format: `SEOF-XXXX-XXXX-XXXX`). */
|
|
385
|
+
licenseKey: string;
|
|
386
|
+
/**
|
|
387
|
+
* A fully custom GROQ query used to fetch documents for the dashboard.
|
|
388
|
+
* The query must return documents with at least: `_id`, `_type`, `title`, `seo`, `_updatedAt`.
|
|
389
|
+
*
|
|
390
|
+
* Takes precedence over `queryTypes` when both are provided.
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* query: `*[_type in ["post","page"] && defined(seo)]{ _id, _type, title, slug, seo, _updatedAt }`
|
|
394
|
+
*/
|
|
395
|
+
query?: string;
|
|
536
396
|
}
|
|
537
|
-
|
|
538
|
-
export declare type SeoHealthStatus = 'excellent' | 'good' | 'fair' | 'poor' | 'missing'
|
|
539
|
-
|
|
540
397
|
/**
|
|
541
|
-
*
|
|
542
|
-
*
|
|
398
|
+
* Creates a desk-structure pane for the SEO Health Dashboard.
|
|
399
|
+
*
|
|
400
|
+
* Returns a **`ComponentBuilder`** with a built-in `.child()` resolver so that
|
|
401
|
+
* clicking any document row opens the document editor as a split pane to the right.
|
|
402
|
+
*
|
|
403
|
+
* Use it **directly** as the `.child()` value — do **not** wrap it in `S.component()`.
|
|
404
|
+
*
|
|
405
|
+
* ```ts
|
|
406
|
+
* // sanity.config.ts
|
|
407
|
+
* structure: (S) =>
|
|
408
|
+
* S.list().items([
|
|
409
|
+
* S.listItem()
|
|
410
|
+
* .title('SEO Health')
|
|
411
|
+
* .child(
|
|
412
|
+
* createSeoHealthPane(S, {
|
|
413
|
+
* licenseKey: 'SEOF-XXXX-XXXX-XXXX',
|
|
414
|
+
* query: `*[_type == "post" && defined(seo)]{ _id, _type, title, slug, seo, _updatedAt }`,
|
|
415
|
+
* })
|
|
416
|
+
* ),
|
|
417
|
+
* ])
|
|
418
|
+
* ```
|
|
543
419
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
declare interface TwitterCardSettings {
|
|
547
|
-
_type: 'twitter'
|
|
548
|
-
card?: 'summary' | 'summary_large_image' | 'app' | 'player'
|
|
549
|
-
site?: string
|
|
550
|
-
creator?: string
|
|
551
|
-
title?: string
|
|
552
|
-
description?: string
|
|
553
|
-
imageType?: 'upload' | 'url'
|
|
554
|
-
image?: SanityImageWithAlt
|
|
555
|
-
imageUrl?: string
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
export declare type twitterFieldKeys =
|
|
559
|
-
| 'twitterCard'
|
|
560
|
-
| 'twitterSite'
|
|
561
|
-
| 'twitterCreator'
|
|
562
|
-
| 'twitterTitle'
|
|
563
|
-
| 'twitterDescription'
|
|
564
|
-
| 'twitterImageType'
|
|
565
|
-
| 'twitterImage'
|
|
566
|
-
| 'twitterImageUrl'
|
|
567
|
-
|
|
568
|
-
export declare function twitterSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
|
|
569
|
-
|
|
570
|
-
export declare type ValidHiddenFieldKeys = Exclude<
|
|
571
|
-
AllFieldKeys,
|
|
572
|
-
'openGraphImageUrl' | 'twitterImageUrl' | 'openGraphImageType' | 'twitterImageType'
|
|
573
|
-
>
|
|
420
|
+
declare function createSeoHealthPane(optionsOrS: StructureBuilder, optionsWhenS: SeoHealthPaneOptions): ComponentBuilder;
|
|
574
421
|
|
|
575
|
-
export {}
|
|
422
|
+
export { type AllFieldKeys, DocumentWithSeoHealth, type FieldVisibilityConfig, type SeoFieldConfig, type SeoFieldKeys, type SeoFieldsPluginConfig, SeoHealthDashboard, type SeoHealthPaneOptions, SeoHealthTool, type ValidHiddenFieldKeys, types as allSchemas, createSeoHealthPane, seofields as default, _default$2 as metaAttributeSchema, _default$1 as metaTagSchema, type openGraphFieldKeys, openGraph as openGraphSchema, _default as robotsSchema, seoFieldsSchema, type twitterFieldKeys, twitter as twitterSchema };
|