sanity-plugin-seofields 1.0.8 â 1.0.10
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 +92 -171
- package/dist/index.d.mts +15 -189
- package/dist/index.d.ts +15 -189
- package/dist/index.js +230 -249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +231 -250
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/SeoPreview.tsx +20 -19
- package/src/components/meta/MetaDescription.tsx +8 -17
- package/src/components/meta/MetaTitle.tsx +8 -17
- package/src/components/openGraph/OgDescription.tsx +6 -4
- package/src/components/openGraph/OgTitle.tsx +8 -6
- package/src/components/twitter/twitterDescription.tsx +9 -7
- package/src/components/twitter/twitterTitle.tsx +7 -5
- package/src/index.ts +3 -6
- package/src/plugin.ts +10 -9
- package/src/schemas/index.ts +10 -15
- package/src/schemas/types/index.ts +7 -5
- package/src/schemas/types/metaAttribute/index.ts +10 -14
- package/src/schemas/types/metaTag/index.ts +15 -14
- package/src/schemas/types/openGraph/index.ts +16 -5
- package/src/schemas/types/twitter/index.ts +16 -4
- package/src/types.ts +4 -65
- package/src/utils/fieldsUtils.ts +17 -96
- package/src/utils/seoUtils.ts +15 -15
- package/src/utils/utils.ts +2 -2
- package/src/types/index.ts +0 -241
- package/src/utils/generaeDynamicJsonLd.ts +0 -295
package/README.md
CHANGED
|
@@ -130,14 +130,14 @@ export default defineType({
|
|
|
130
130
|
|
|
131
131
|
## đ¨ Available Schema Types
|
|
132
132
|
|
|
133
|
-
| Type | Description
|
|
134
|
-
| --------------- |
|
|
135
|
-
| `seoFields` | Complete SEO package
|
|
136
|
-
| `openGraph` | Open Graph meta tags
|
|
137
|
-
| `twitter` | X (Formerly Twitter) Card settings | X-specific optimization
|
|
138
|
-
| `metaTag` | Custom meta attributes
|
|
139
|
-
| `metaAttribute` | Individual meta attribute
|
|
140
|
-
| `robots` | Search engine directives
|
|
133
|
+
| Type | Description | Use Case |
|
|
134
|
+
| --------------- | ---------------------------------- | -------------------------------- |
|
|
135
|
+
| `seoFields` | Complete SEO package | Main SEO fields for any document |
|
|
136
|
+
| `openGraph` | Open Graph meta tags | Social media sharing |
|
|
137
|
+
| `twitter` | X (Formerly Twitter) Card settings | X-specific optimization |
|
|
138
|
+
| `metaTag` | Custom meta attributes | Advanced meta tag management |
|
|
139
|
+
| `metaAttribute` | Individual meta attribute | Building custom meta tags |
|
|
140
|
+
| `robots` | Search engine directives | Control indexing and crawling |
|
|
141
141
|
|
|
142
142
|
## đ§ Configuration Options
|
|
143
143
|
|
|
@@ -189,14 +189,14 @@ export default defineConfig({
|
|
|
189
189
|
// Hide sitewide fields on specific content types
|
|
190
190
|
fieldVisibility: {
|
|
191
191
|
page: {
|
|
192
|
-
hiddenFields: ['openGraphSiteName', 'twitterSite']
|
|
192
|
+
hiddenFields: ['openGraphSiteName', 'twitterSite'],
|
|
193
193
|
},
|
|
194
194
|
post: {
|
|
195
|
-
hiddenFields: ['openGraphSiteName', 'twitterSite']
|
|
196
|
-
}
|
|
195
|
+
hiddenFields: ['openGraphSiteName', 'twitterSite'],
|
|
196
|
+
},
|
|
197
197
|
},
|
|
198
198
|
// Or hide fields globally
|
|
199
|
-
defaultHiddenFields: ['openGraphSiteName', 'twitterSite']
|
|
199
|
+
defaultHiddenFields: ['openGraphSiteName', 'twitterSite'],
|
|
200
200
|
} satisfies SeoFieldsPluginConfig),
|
|
201
201
|
],
|
|
202
202
|
})
|
|
@@ -220,53 +220,48 @@ Each field in the `fieldOverrides` object can have:
|
|
|
220
220
|
|
|
221
221
|
**Available field keys:**
|
|
222
222
|
|
|
223
|
-
- `title`
|
|
224
|
-
- `
|
|
225
|
-
- `
|
|
226
|
-
- `metaImage`
|
|
227
|
-
- `keywords`
|
|
228
|
-
- `metaAttributes`
|
|
223
|
+
- `title`, `description`, `canonicalUrl`, `metaImage`, `keywords`, `metaAttributes`, `robots`
|
|
224
|
+
- `openGraphUrl`, `openGraphTitle`, `openGraphDescription`, `openGraphSiteName`, `openGraphType`, `openGraphImage`
|
|
225
|
+
- `twitterCard`, `twitterSite`, `twitterCreator`, `twitterTitle`, `twitterDescription`, `twitterImage`
|
|
229
226
|
|
|
230
227
|
#### Field Visibility Configuration
|
|
231
228
|
|
|
232
229
|
Control which fields are visible on different content types. You can hide any SEO field on any post type:
|
|
233
230
|
|
|
234
231
|
**Available field keys:**
|
|
235
|
-
|
|
236
|
-
- `description`
|
|
237
|
-
- `
|
|
238
|
-
- `
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
- `robots` - Robots Settings field
|
|
242
|
-
- `openGraphSiteName` - Open Graph Site Name field (sitewide)
|
|
243
|
-
- `twitterSite` - X (Formerly Twitter) Site Handle field (sitewide)
|
|
232
|
+
|
|
233
|
+
- `title`, `description`, `canonicalUrl`, `metaImage`, `keywords`, `metaAttributes`, `robots`
|
|
234
|
+
- `openGraphUrl`, `openGraphTitle`, `openGraphDescription`, `openGraphSiteName`, `openGraphType`, `openGraphImage`
|
|
235
|
+
- `twitterCard`, `twitterSite`, `twitterCreator`, `twitterTitle`, `twitterDescription`, `twitterImage`
|
|
236
|
+
|
|
237
|
+
> âšī¸ Hiding `openGraphImage` or `twitterImage` also hides their URL and type variants to keep the editor experience consistent.
|
|
244
238
|
|
|
245
239
|
**Example configurations:**
|
|
246
240
|
|
|
247
241
|
```typescript
|
|
248
242
|
// Hide fields globally
|
|
249
243
|
seofields({
|
|
250
|
-
defaultHiddenFields: ['openGraphSiteName', 'twitterSite', 'keywords']
|
|
244
|
+
defaultHiddenFields: ['openGraphSiteName', 'twitterSite', 'keywords'],
|
|
251
245
|
})
|
|
252
246
|
|
|
253
247
|
// Hide fields on specific content types
|
|
254
248
|
seofields({
|
|
255
249
|
fieldVisibility: {
|
|
256
250
|
page: {
|
|
257
|
-
hiddenFields: ['openGraphSiteName', 'twitterSite', 'keywords']
|
|
251
|
+
hiddenFields: ['openGraphSiteName', 'twitterSite', 'keywords'],
|
|
258
252
|
},
|
|
259
253
|
post: {
|
|
260
|
-
hiddenFields: ['openGraphSiteName', 'metaAttributes']
|
|
254
|
+
hiddenFields: ['openGraphSiteName', 'metaAttributes'],
|
|
261
255
|
},
|
|
262
256
|
product: {
|
|
263
|
-
hiddenFields: ['canonicalUrl', 'robots']
|
|
264
|
-
}
|
|
265
|
-
}
|
|
257
|
+
hiddenFields: ['canonicalUrl', 'robots'],
|
|
258
|
+
},
|
|
259
|
+
},
|
|
266
260
|
})
|
|
267
261
|
```
|
|
268
262
|
|
|
269
263
|
This is particularly useful when you want to:
|
|
264
|
+
|
|
270
265
|
- Manage sitewide settings (like site name and X handle) in a dedicated Site Settings document
|
|
271
266
|
- Simplify the editing experience by hiding fields that aren't relevant for certain content types
|
|
272
267
|
- Create different SEO workflows for different content types
|
|
@@ -285,6 +280,30 @@ This is particularly useful when you want to:
|
|
|
285
280
|
- **Purpose**: Search result descriptions
|
|
286
281
|
- **Best Practice**: Compelling summary with keywords
|
|
287
282
|
|
|
283
|
+
#### Canonical URL
|
|
284
|
+
|
|
285
|
+
- **Format**: Must include protocol (https://)
|
|
286
|
+
- **Purpose**: Signals the preferred URL when duplicate or paginated content exists
|
|
287
|
+
- **Best Practice**: Mirror the resolved frontend route exactly to avoid mismatched indexing
|
|
288
|
+
|
|
289
|
+
#### Meta Image
|
|
290
|
+
|
|
291
|
+
- **Recommended Size**: 1200x630px minimum 600x315px
|
|
292
|
+
- **Purpose**: Default share image when Open Graph/Twitter images are absent
|
|
293
|
+
- **Best Practice**: Provide descriptive alt text and keep file size under 5MB
|
|
294
|
+
|
|
295
|
+
#### Meta Attributes
|
|
296
|
+
|
|
297
|
+
- **Structure**: Key/value pairs or key/image pairs
|
|
298
|
+
- **Purpose**: Add bespoke `<meta>` tags (for example `theme-color`, `author`, verification tokens)
|
|
299
|
+
- **Best Practice**: Avoid duplicating tags already generated elsewhere to limit head bloat
|
|
300
|
+
|
|
301
|
+
#### Keywords
|
|
302
|
+
|
|
303
|
+
- **Type**: Array of short strings
|
|
304
|
+
- **Purpose**: Editorial helper; not surfaced automatically to search engines
|
|
305
|
+
- **Best Practice**: Keep entries concise (1-3 words) and limit to high-intent topics
|
|
306
|
+
|
|
288
307
|
#### Open Graph Image
|
|
289
308
|
|
|
290
309
|
- **Recommended Size**: 1200x630px
|
|
@@ -299,6 +318,16 @@ This is particularly useful when you want to:
|
|
|
299
318
|
- **Best Practice**: Use the preferred URL for the page to avoid duplicate content issues
|
|
300
319
|
- **Required**: Should match the actual page URL for consistency
|
|
301
320
|
|
|
321
|
+
#### Open Graph Site Name
|
|
322
|
+
|
|
323
|
+
- **Purpose**: Displays publisher name on share previews
|
|
324
|
+
- **Best Practice**: Keep consistent with brand name used across marketing channels
|
|
325
|
+
|
|
326
|
+
#### Open Graph Type
|
|
327
|
+
|
|
328
|
+
- **Options**: `website`, `article`, `profile`, `book`, `music`, `video`, `product`
|
|
329
|
+
- **Best Practice**: Pick the narrowest type applicable to unlock platform-specific rendering
|
|
330
|
+
|
|
302
331
|
#### X (Formerly Twitter) Card Image
|
|
303
332
|
|
|
304
333
|
- **Summary Card**: Minimum 120x120px
|
|
@@ -312,81 +341,22 @@ This is particularly useful when you want to:
|
|
|
312
341
|
- **Usage**: Identifies the individual author of the content
|
|
313
342
|
- **Best Practice**: Use actual X handles for proper attribution
|
|
314
343
|
|
|
315
|
-
|
|
344
|
+
#### X (Formerly Twitter) Card Type
|
|
316
345
|
|
|
317
|
-
|
|
346
|
+
- **Options**: `summary`, `summary_large_image`, `app`, `player`
|
|
347
|
+
- **Best Practice**: Use `summary_large_image` for rich media, fall back to `summary` when imagery is square or minimal
|
|
318
348
|
|
|
319
|
-
|
|
320
|
-
import type {
|
|
321
|
-
SeoFields,
|
|
322
|
-
OpenGraphSettings,
|
|
323
|
-
TwitterCardSettings,
|
|
324
|
-
SeoFieldsPluginConfig,
|
|
325
|
-
} from 'sanity-plugin-seofields'
|
|
326
|
-
|
|
327
|
-
// Plugin configuration
|
|
328
|
-
const pluginConfig: SeoFieldsPluginConfig = {
|
|
329
|
-
seoPreview: true,
|
|
330
|
-
fields: {
|
|
331
|
-
title: {
|
|
332
|
-
title: 'Page Title',
|
|
333
|
-
description: 'The main title for search engines',
|
|
334
|
-
},
|
|
335
|
-
description: {
|
|
336
|
-
title: 'Meta Description',
|
|
337
|
-
description: 'Brief description for search results',
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
}
|
|
349
|
+
#### X (Formerly Twitter) Site Handle
|
|
341
350
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
title: string
|
|
346
|
-
seo?: SeoFields
|
|
347
|
-
}
|
|
351
|
+
- **Purpose**: Publisher attribution when multiple authors contribute
|
|
352
|
+
- **Format**: X handle with @ symbol (e.g., @brand)
|
|
353
|
+
- **Best Practice**: Configure once in site settings and hide on document types that inherit it
|
|
348
354
|
|
|
349
|
-
|
|
350
|
-
const seoData: SeoFields = {
|
|
351
|
-
_type: 'seoFields',
|
|
352
|
-
title: 'My Page Title',
|
|
353
|
-
description: 'A great page description',
|
|
354
|
-
openGraph: {
|
|
355
|
-
_type: 'openGraph',
|
|
356
|
-
title: 'Social Media Title',
|
|
357
|
-
description: 'Social media description',
|
|
358
|
-
url: 'https://example.com/page',
|
|
359
|
-
type: 'website',
|
|
360
|
-
},
|
|
361
|
-
twitter: {
|
|
362
|
-
_type: 'twitter',
|
|
363
|
-
card: 'summary_large_image',
|
|
364
|
-
site: '@example',
|
|
365
|
-
creator: '@creator',
|
|
366
|
-
title: 'Twitter Title',
|
|
367
|
-
description: 'Twitter description',
|
|
368
|
-
},
|
|
369
|
-
}
|
|
370
|
-
```
|
|
355
|
+
#### Robots Settings
|
|
371
356
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
import type {
|
|
376
|
-
SeoFields,
|
|
377
|
-
SeoFieldsPluginConfig,
|
|
378
|
-
SeoFieldConfig,
|
|
379
|
-
SeoFieldKeys,
|
|
380
|
-
SitewideFieldKeys,
|
|
381
|
-
FieldVisibilityConfig,
|
|
382
|
-
OpenGraphSettings,
|
|
383
|
-
TwitterCardSettings,
|
|
384
|
-
MetaAttribute,
|
|
385
|
-
MetaTag,
|
|
386
|
-
RobotsSettings,
|
|
387
|
-
SanityImage,
|
|
388
|
-
} from 'sanity-plugin-seofields'
|
|
389
|
-
```
|
|
357
|
+
- **Options**: `noIndex`, `noFollow`
|
|
358
|
+
- **Purpose**: Control whether pages are indexed or links followed by crawlers
|
|
359
|
+
- **Best Practice**: Only enable when intentionally blocking content (for example gated pages or previews)
|
|
390
360
|
|
|
391
361
|
## đī¸ Field Visibility Feature
|
|
392
362
|
|
|
@@ -399,15 +369,15 @@ The field visibility feature allows you to hide any SEO field on specific conten
|
|
|
399
369
|
seofields({
|
|
400
370
|
fieldVisibility: {
|
|
401
371
|
page: {
|
|
402
|
-
hiddenFields: ['openGraphSiteName', 'twitterSite', 'keywords']
|
|
372
|
+
hiddenFields: ['openGraphSiteName', 'twitterSite', 'keywords'],
|
|
403
373
|
},
|
|
404
374
|
post: {
|
|
405
|
-
hiddenFields: ['openGraphSiteName', 'metaAttributes']
|
|
375
|
+
hiddenFields: ['openGraphSiteName', 'metaAttributes'],
|
|
406
376
|
},
|
|
407
377
|
product: {
|
|
408
|
-
hiddenFields: ['canonicalUrl', 'robots']
|
|
409
|
-
}
|
|
410
|
-
}
|
|
378
|
+
hiddenFields: ['canonicalUrl', 'robots'],
|
|
379
|
+
},
|
|
380
|
+
},
|
|
411
381
|
})
|
|
412
382
|
```
|
|
413
383
|
|
|
@@ -475,45 +445,28 @@ defineField({
|
|
|
475
445
|
|
|
476
446
|
### Next.js Example
|
|
477
447
|
|
|
478
|
-
```
|
|
479
|
-
import {SeoFields} from 'sanity-plugin-seofields'
|
|
448
|
+
```tsx
|
|
480
449
|
import Head from 'next/head'
|
|
481
450
|
|
|
482
|
-
|
|
483
|
-
seo?: SeoFields
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
export function SEOHead({seo}: SEOProps) {
|
|
451
|
+
export function SEOHead({seo}) {
|
|
487
452
|
if (!seo) return null
|
|
488
453
|
|
|
489
454
|
return (
|
|
490
455
|
<Head>
|
|
491
456
|
{seo.title && <title>{seo.title}</title>}
|
|
492
|
-
{seo.description &&
|
|
493
|
-
<meta name="description" content={seo.description} />
|
|
494
|
-
)}
|
|
457
|
+
{seo.description && <meta name="description" content={seo.description} />}
|
|
495
458
|
|
|
496
459
|
{/* Open Graph */}
|
|
497
|
-
{seo.openGraph?.title &&
|
|
498
|
-
<meta property="og:title" content={seo.openGraph.title} />
|
|
499
|
-
)}
|
|
460
|
+
{seo.openGraph?.title && <meta property="og:title" content={seo.openGraph.title} />}
|
|
500
461
|
{seo.openGraph?.description && (
|
|
501
462
|
<meta property="og:description" content={seo.openGraph.description} />
|
|
502
463
|
)}
|
|
503
|
-
{seo.openGraph?.url &&
|
|
504
|
-
<meta property="og:url" content={seo.openGraph.url} />
|
|
505
|
-
)}
|
|
464
|
+
{seo.openGraph?.url && <meta property="og:url" content={seo.openGraph.url} />}
|
|
506
465
|
|
|
507
466
|
{/* Twitter */}
|
|
508
|
-
{seo.twitter?.card &&
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
{seo.twitter?.site && (
|
|
512
|
-
<meta name="twitter:site" content={seo.twitter.site} />
|
|
513
|
-
)}
|
|
514
|
-
{seo.twitter?.creator && (
|
|
515
|
-
<meta name="twitter:creator" content={seo.twitter.creator} />
|
|
516
|
-
)}
|
|
467
|
+
{seo.twitter?.card && <meta name="twitter:card" content={seo.twitter.card} />}
|
|
468
|
+
{seo.twitter?.site && <meta name="twitter:site" content={seo.twitter.site} />}
|
|
469
|
+
{seo.twitter?.creator && <meta name="twitter:creator" content={seo.twitter.creator} />}
|
|
517
470
|
|
|
518
471
|
{/* Robots */}
|
|
519
472
|
{seo.robots?.noIndex && <meta name="robots" content="noindex" />}
|
|
@@ -528,24 +481,17 @@ export function SEOHead({seo}: SEOProps) {
|
|
|
528
481
|
|
|
529
482
|
### React/Gatsby Example
|
|
530
483
|
|
|
531
|
-
```
|
|
484
|
+
```tsx
|
|
532
485
|
import {Helmet} from 'react-helmet'
|
|
533
|
-
import {SeoFields} from 'sanity-plugin-seofields'
|
|
534
486
|
|
|
535
|
-
|
|
536
|
-
seo?: SeoFields
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
export function SEO({seo}: SEOProps) {
|
|
487
|
+
export function SEO({seo}) {
|
|
540
488
|
return (
|
|
541
489
|
<Helmet>
|
|
542
490
|
<title>{seo?.title}</title>
|
|
543
491
|
<meta name="description" content={seo?.description} />
|
|
544
492
|
|
|
545
493
|
{/* Keywords */}
|
|
546
|
-
{seo?.keywords && (
|
|
547
|
-
<meta name="keywords" content={seo.keywords.join(', ')} />
|
|
548
|
-
)}
|
|
494
|
+
{seo?.keywords && <meta name="keywords" content={seo.keywords.join(', ')} />}
|
|
549
495
|
|
|
550
496
|
{/* Open Graph */}
|
|
551
497
|
<meta property="og:title" content={seo?.openGraph?.title} />
|
|
@@ -554,15 +500,9 @@ export function SEO({seo}: SEOProps) {
|
|
|
554
500
|
<meta property="og:type" content={seo?.openGraph?.type || 'website'} />
|
|
555
501
|
|
|
556
502
|
{/* Twitter */}
|
|
557
|
-
{seo?.twitter?.card &&
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
{seo?.twitter?.site && (
|
|
561
|
-
<meta name="twitter:site" content={seo.twitter.site} />
|
|
562
|
-
)}
|
|
563
|
-
{seo?.twitter?.creator && (
|
|
564
|
-
<meta name="twitter:creator" content={seo.twitter.creator} />
|
|
565
|
-
)}
|
|
503
|
+
{seo?.twitter?.card && <meta name="twitter:card" content={seo.twitter.card} />}
|
|
504
|
+
{seo?.twitter?.site && <meta name="twitter:site" content={seo.twitter.site} />}
|
|
505
|
+
{seo?.twitter?.creator && <meta name="twitter:creator" content={seo.twitter.creator} />}
|
|
566
506
|
</Helmet>
|
|
567
507
|
)
|
|
568
508
|
}
|
|
@@ -585,25 +525,6 @@ import seofields from 'sanity-plugin-seofields'
|
|
|
585
525
|
- `metaAttribute` - Individual meta attribute
|
|
586
526
|
- `robots` - Search engine robots settings
|
|
587
527
|
|
|
588
|
-
### TypeScript Types
|
|
589
|
-
|
|
590
|
-
All types are exported from the main module for use in your project.
|
|
591
|
-
|
|
592
|
-
### Migration Utilities
|
|
593
|
-
|
|
594
|
-
The plugin includes utilities for migrating existing data from old formats:
|
|
595
|
-
|
|
596
|
-
```typescript
|
|
597
|
-
import {
|
|
598
|
-
migrateSeoFields,
|
|
599
|
-
generateMigrationScript,
|
|
600
|
-
needsMigration,
|
|
601
|
-
normalizeValue
|
|
602
|
-
} from 'sanity-plugin-seofields'
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
For detailed migration instructions, see [MIGRATION_GUIDE.md](./MIGRATION_GUIDE.md).
|
|
606
|
-
|
|
607
528
|
## đ¤ Contributing
|
|
608
529
|
|
|
609
530
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,82 +1,14 @@
|
|
|
1
1
|
import {ObjectDefinition} from 'sanity'
|
|
2
2
|
import {Plugin as Plugin_2} from 'sanity'
|
|
3
3
|
import {PreviewConfig} from 'sanity'
|
|
4
|
+
import {SchemaTypeDefinition} from 'sanity'
|
|
4
5
|
|
|
5
6
|
export declare type AllFieldKeys = SeoFieldKeys | openGraphFieldKeys | twitterFieldKeys
|
|
6
7
|
|
|
7
|
-
export declare function allSchemas(config?: SeoFieldsPluginConfig):
|
|
8
|
-
| ({
|
|
9
|
-
type: 'object'
|
|
10
|
-
name: 'twitter'
|
|
11
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
12
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
13
|
-
})
|
|
14
|
-
| ({
|
|
15
|
-
type: 'object'
|
|
16
|
-
name: 'seoFields'
|
|
17
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
18
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
19
|
-
})
|
|
20
|
-
| ({
|
|
21
|
-
type: 'object'
|
|
22
|
-
name: 'metaAttribute'
|
|
23
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
24
|
-
preview?:
|
|
25
|
-
| PreviewConfig<
|
|
26
|
-
{
|
|
27
|
-
attributeName: string
|
|
28
|
-
attributeValueString: string
|
|
29
|
-
attributeValueImage: string
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
attributeName: string
|
|
33
|
-
attributeValueString: string
|
|
34
|
-
attributeValueImage: any
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
| undefined
|
|
38
|
-
})
|
|
39
|
-
| ({
|
|
40
|
-
type: 'object'
|
|
41
|
-
name: 'openGraph'
|
|
42
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
43
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
44
|
-
})
|
|
45
|
-
| ({
|
|
46
|
-
type: 'object'
|
|
47
|
-
name: 'robots'
|
|
48
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
49
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
50
|
-
})
|
|
51
|
-
| ({
|
|
52
|
-
type: 'object'
|
|
53
|
-
name: 'metaTag'
|
|
54
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
55
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
56
|
-
})
|
|
57
|
-
)[]
|
|
58
|
-
|
|
59
|
-
export declare const defaultSeoValidationRules: SeoValidationRules
|
|
8
|
+
export declare function allSchemas(config?: SeoFieldsPluginConfig): SchemaTypeDefinition[]
|
|
60
9
|
|
|
61
10
|
export declare interface FieldVisibilityConfig {
|
|
62
|
-
hiddenFields?:
|
|
63
|
-
postType?: string
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export declare const isMetaAttribute: (obj: any) => obj is MetaAttribute
|
|
67
|
-
|
|
68
|
-
export declare const isOpenGraphSettings: (obj: any) => obj is OpenGraphSettings
|
|
69
|
-
|
|
70
|
-
export declare const isSeoFields: (obj: any) => obj is SeoFields
|
|
71
|
-
|
|
72
|
-
export declare const isTwitterCardSettings: (obj: any) => obj is TwitterCardSettings
|
|
73
|
-
|
|
74
|
-
export declare interface MetaAttribute {
|
|
75
|
-
_type: 'metaAttribute'
|
|
76
|
-
key: string
|
|
77
|
-
type: 'string' | 'image'
|
|
78
|
-
value?: string
|
|
79
|
-
image?: SanityImage
|
|
11
|
+
hiddenFields?: ValidHiddenFieldKeys[]
|
|
80
12
|
}
|
|
81
13
|
|
|
82
14
|
export declare const metaAttributeSchema: {
|
|
@@ -90,11 +22,7 @@ export declare const metaAttributeSchema: {
|
|
|
90
22
|
attributeValueString: string
|
|
91
23
|
attributeValueImage: string
|
|
92
24
|
},
|
|
93
|
-
|
|
94
|
-
attributeName: string
|
|
95
|
-
attributeValueString: string
|
|
96
|
-
attributeValueImage: any
|
|
97
|
-
}
|
|
25
|
+
Record<'attributeName' | 'attributeValueString' | 'attributeValueImage', any>
|
|
98
26
|
>
|
|
99
27
|
| undefined
|
|
100
28
|
}
|
|
@@ -116,23 +44,7 @@ export declare type openGraphFieldKeys =
|
|
|
116
44
|
| 'openGraphImage'
|
|
117
45
|
| 'openGraphImageUrl'
|
|
118
46
|
|
|
119
|
-
export declare function openGraphSchema(config?: SeoFieldsPluginConfig):
|
|
120
|
-
type: 'object'
|
|
121
|
-
name: 'openGraph'
|
|
122
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
123
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export declare interface OpenGraphSettings {
|
|
127
|
-
_type: 'openGraph'
|
|
128
|
-
title?: string
|
|
129
|
-
description?: string
|
|
130
|
-
siteName?: string
|
|
131
|
-
type?: 'website' | 'article' | 'profile' | 'book' | 'music' | 'video' | 'product'
|
|
132
|
-
imageType?: 'upload' | 'url'
|
|
133
|
-
image?: SanityImageWithAlt
|
|
134
|
-
imageUrl?: string
|
|
135
|
-
}
|
|
47
|
+
export declare function openGraphSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
|
|
136
48
|
|
|
137
49
|
export declare const robotsSchema: {
|
|
138
50
|
type: 'object'
|
|
@@ -141,36 +53,6 @@ export declare const robotsSchema: {
|
|
|
141
53
|
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
142
54
|
}
|
|
143
55
|
|
|
144
|
-
export declare interface RobotsSettings {
|
|
145
|
-
noIndex?: boolean
|
|
146
|
-
noFollow?: boolean
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export declare interface SanityImage {
|
|
150
|
-
_type: 'image'
|
|
151
|
-
asset: {
|
|
152
|
-
_ref: string
|
|
153
|
-
_type: 'reference'
|
|
154
|
-
}
|
|
155
|
-
hotspot?: {
|
|
156
|
-
x: number
|
|
157
|
-
y: number
|
|
158
|
-
height: number
|
|
159
|
-
width: number
|
|
160
|
-
}
|
|
161
|
-
crop?: {
|
|
162
|
-
top: number
|
|
163
|
-
bottom: number
|
|
164
|
-
left: number
|
|
165
|
-
right: number
|
|
166
|
-
}
|
|
167
|
-
alt?: string
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export declare interface SanityImageWithAlt extends SanityImage {
|
|
171
|
-
alt: string
|
|
172
|
-
}
|
|
173
|
-
|
|
174
56
|
export declare interface SeoFieldConfig {
|
|
175
57
|
title?: string
|
|
176
58
|
description?: string
|
|
@@ -185,19 +67,6 @@ export declare type SeoFieldKeys =
|
|
|
185
67
|
| 'metaAttributes'
|
|
186
68
|
| 'robots'
|
|
187
69
|
|
|
188
|
-
export declare interface SeoFields {
|
|
189
|
-
_type: 'seoFields'
|
|
190
|
-
robots?: RobotsSettings
|
|
191
|
-
preview?: string
|
|
192
|
-
title?: string
|
|
193
|
-
description?: string
|
|
194
|
-
metaImage?: SanityImage
|
|
195
|
-
keywords?: string[]
|
|
196
|
-
canonicalUrl?: string
|
|
197
|
-
openGraph?: OpenGraphSettings
|
|
198
|
-
twitter?: TwitterCardSettings
|
|
199
|
-
}
|
|
200
|
-
|
|
201
70
|
declare const seofields: Plugin_2<void | SeoFieldsPluginConfig>
|
|
202
71
|
export default seofields
|
|
203
72
|
|
|
@@ -228,21 +97,17 @@ export declare interface SeoFieldsPluginConfig {
|
|
|
228
97
|
* This allows customization of field titles and descriptions.
|
|
229
98
|
* For example, to change the title of the 'title' field:
|
|
230
99
|
*/
|
|
231
|
-
fieldOverrides?:
|
|
232
|
-
[key in AllFieldKeys]?: SeoFieldConfig
|
|
233
|
-
}
|
|
100
|
+
fieldOverrides?: Partial<Record<AllFieldKeys, SeoFieldConfig>>
|
|
234
101
|
/**
|
|
235
102
|
* A mapping of document types to field visibility configurations.
|
|
236
103
|
* This allows you to specify which fields should be hidden for specific document types.
|
|
237
104
|
*/
|
|
238
|
-
fieldVisibility?:
|
|
239
|
-
[postType: string]: FieldVisibilityConfig
|
|
240
|
-
}
|
|
105
|
+
fieldVisibility?: Record<string, FieldVisibilityConfig>
|
|
241
106
|
/**
|
|
242
107
|
* A list of fields that should be hidden by default in all document types.
|
|
243
108
|
* This can be overridden by specific document type settings in `fieldVisibility`.
|
|
244
109
|
*/
|
|
245
|
-
defaultHiddenFields?:
|
|
110
|
+
defaultHiddenFields?: ValidHiddenFieldKeys[]
|
|
246
111
|
/**
|
|
247
112
|
* The base URL of your website, used for generating full URLs in the SEO preview.
|
|
248
113
|
* Defaults to 'https://www.example.com' if not provided.
|
|
@@ -250,46 +115,7 @@ export declare interface SeoFieldsPluginConfig {
|
|
|
250
115
|
baseUrl?: string
|
|
251
116
|
}
|
|
252
117
|
|
|
253
|
-
export declare function seoFieldsSchema(config?: SeoFieldsPluginConfig):
|
|
254
|
-
type: 'object'
|
|
255
|
-
name: 'seoFields'
|
|
256
|
-
} & Omit<ObjectDefinition, 'preview'> & {
|
|
257
|
-
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export declare interface SeoValidationRules {
|
|
261
|
-
title: {
|
|
262
|
-
maxLength: number
|
|
263
|
-
warningLength: number
|
|
264
|
-
}
|
|
265
|
-
description: {
|
|
266
|
-
maxLength: number
|
|
267
|
-
warningLength: number
|
|
268
|
-
}
|
|
269
|
-
openGraphTitle: {
|
|
270
|
-
maxLength: number
|
|
271
|
-
}
|
|
272
|
-
openGraphDescription: {
|
|
273
|
-
maxLength: number
|
|
274
|
-
}
|
|
275
|
-
twitterTitle: {
|
|
276
|
-
maxLength: number
|
|
277
|
-
}
|
|
278
|
-
twitterDescription: {
|
|
279
|
-
maxLength: number
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export declare interface TwitterCardSettings {
|
|
284
|
-
_type: 'twitter'
|
|
285
|
-
card?: 'summary' | 'summary_large_image' | 'app' | 'player'
|
|
286
|
-
site?: string
|
|
287
|
-
title?: string
|
|
288
|
-
description?: string
|
|
289
|
-
imageType?: 'upload' | 'url'
|
|
290
|
-
image?: SanityImageWithAlt
|
|
291
|
-
imageUrl?: string
|
|
292
|
-
}
|
|
118
|
+
export declare function seoFieldsSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
|
|
293
119
|
|
|
294
120
|
export declare type twitterFieldKeys =
|
|
295
121
|
| 'twitterCard'
|
|
@@ -301,11 +127,11 @@ export declare type twitterFieldKeys =
|
|
|
301
127
|
| 'twitterImage'
|
|
302
128
|
| 'twitterImageUrl'
|
|
303
129
|
|
|
304
|
-
export declare function twitterSchema(config?: SeoFieldsPluginConfig):
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
130
|
+
export declare function twitterSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
|
|
131
|
+
|
|
132
|
+
export declare type ValidHiddenFieldKeys = Exclude<
|
|
133
|
+
AllFieldKeys,
|
|
134
|
+
'openGraphImageUrl' | 'twitterImageUrl' | 'openGraphImageType' | 'twitterImageType'
|
|
135
|
+
>
|
|
310
136
|
|
|
311
137
|
export {}
|