sanity-plugin-seofields 1.0.1
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/LICENSE +21 -0
- package/README.md +379 -0
- package/dist/index.d.mts +226 -0
- package/dist/index.d.ts +226 -0
- package/dist/index.js +730 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +733 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +83 -0
- package/sanity.json +8 -0
- package/src/components/SeoPreview.tsx +75 -0
- package/src/components/meta/MetaDescription.tsx +47 -0
- package/src/components/meta/MetaTitle.tsx +52 -0
- package/src/components/openGraph/OgDescription.tsx +43 -0
- package/src/components/openGraph/OgTitle.tsx +42 -0
- package/src/components/twitter/twitterDescription.tsx +42 -0
- package/src/components/twitter/twitterTitle.tsx +42 -0
- package/src/index.ts +15 -0
- package/src/plugin.ts +28 -0
- package/src/schemas/index.ts +93 -0
- package/src/schemas/types/index.ts +7 -0
- package/src/schemas/types/metaAttribute/index.ts +64 -0
- package/src/schemas/types/metaTag/index.ts +16 -0
- package/src/schemas/types/openGraph/index.ts +86 -0
- package/src/schemas/types/robots/index.ts +26 -0
- package/src/schemas/types/twitter/index.ts +68 -0
- package/src/types/index.ts +239 -0
- package/src/types.ts +144 -0
- package/src/utils/generaeDynamicJsonLd.ts +295 -0
- package/src/utils/seoUtils.ts +386 -0
- package/v2-incompatible.js +11 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {ObjectDefinition} from 'sanity'
|
|
2
|
+
import {Plugin as Plugin_2} from 'sanity'
|
|
3
|
+
import {PreviewConfig} from 'sanity'
|
|
4
|
+
|
|
5
|
+
export declare const allSchemas: (
|
|
6
|
+
| ({
|
|
7
|
+
type: 'object'
|
|
8
|
+
name: 'seoFields'
|
|
9
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
10
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
11
|
+
})
|
|
12
|
+
| ({
|
|
13
|
+
type: 'object'
|
|
14
|
+
name: 'metaAttribute'
|
|
15
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
16
|
+
preview?:
|
|
17
|
+
| PreviewConfig<
|
|
18
|
+
{
|
|
19
|
+
attributeName: string
|
|
20
|
+
attributeValueString: string
|
|
21
|
+
attributeValueImage: string
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
attributeName: string
|
|
25
|
+
attributeValueString: string
|
|
26
|
+
attributeValueImage: any
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
| undefined
|
|
30
|
+
})
|
|
31
|
+
| ({
|
|
32
|
+
type: 'object'
|
|
33
|
+
name: 'openGraph'
|
|
34
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
35
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
36
|
+
})
|
|
37
|
+
| ({
|
|
38
|
+
type: 'object'
|
|
39
|
+
name: 'twitter'
|
|
40
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
41
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
42
|
+
})
|
|
43
|
+
| ({
|
|
44
|
+
type: 'object'
|
|
45
|
+
name: 'robots'
|
|
46
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
47
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
48
|
+
})
|
|
49
|
+
| ({
|
|
50
|
+
type: 'object'
|
|
51
|
+
name: 'metaTag'
|
|
52
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
53
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
54
|
+
})
|
|
55
|
+
)[]
|
|
56
|
+
|
|
57
|
+
export declare const defaultSeoValidationRules: SeoValidationRules
|
|
58
|
+
|
|
59
|
+
export declare const isMetaAttribute: (obj: any) => obj is MetaAttribute
|
|
60
|
+
|
|
61
|
+
export declare const isOpenGraphSettings: (obj: any) => obj is OpenGraphSettings
|
|
62
|
+
|
|
63
|
+
export declare const isSeoFields: (obj: any) => obj is SeoFields
|
|
64
|
+
|
|
65
|
+
export declare const isTwitterCardSettings: (obj: any) => obj is TwitterCardSettings
|
|
66
|
+
|
|
67
|
+
export declare interface MetaAttribute {
|
|
68
|
+
_type: 'metaAttribute'
|
|
69
|
+
key: string
|
|
70
|
+
type: 'string' | 'image'
|
|
71
|
+
value?: string
|
|
72
|
+
image?: SanityImage
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare const metaAttributeSchema: {
|
|
76
|
+
type: 'object'
|
|
77
|
+
name: 'metaAttribute'
|
|
78
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
79
|
+
preview?:
|
|
80
|
+
| PreviewConfig<
|
|
81
|
+
{
|
|
82
|
+
attributeName: string
|
|
83
|
+
attributeValueString: string
|
|
84
|
+
attributeValueImage: string
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
attributeName: string
|
|
88
|
+
attributeValueString: string
|
|
89
|
+
attributeValueImage: any
|
|
90
|
+
}
|
|
91
|
+
>
|
|
92
|
+
| undefined
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export declare const metaTagSchema: {
|
|
96
|
+
type: 'object'
|
|
97
|
+
name: 'metaTag'
|
|
98
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
99
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
declare interface MyPluginConfig {}
|
|
103
|
+
|
|
104
|
+
export declare const openGraphSchema: {
|
|
105
|
+
type: 'object'
|
|
106
|
+
name: 'openGraph'
|
|
107
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
108
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export declare interface OpenGraphSettings {
|
|
112
|
+
_type: 'openGraph'
|
|
113
|
+
title?: string
|
|
114
|
+
description?: string
|
|
115
|
+
siteName?: string
|
|
116
|
+
type?: 'website' | 'article' | 'profile' | 'book' | 'music' | 'video' | 'product'
|
|
117
|
+
imageType?: 'upload' | 'url'
|
|
118
|
+
image?: SanityImage
|
|
119
|
+
imageUrl?: string
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare interface RobotsSettings {
|
|
123
|
+
noIndex?: boolean
|
|
124
|
+
noFollow?: boolean
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export declare interface SanityImage {
|
|
128
|
+
_type: 'image'
|
|
129
|
+
asset: {
|
|
130
|
+
_ref: string
|
|
131
|
+
_type: 'reference'
|
|
132
|
+
}
|
|
133
|
+
hotspot?: {
|
|
134
|
+
x: number
|
|
135
|
+
y: number
|
|
136
|
+
height: number
|
|
137
|
+
width: number
|
|
138
|
+
}
|
|
139
|
+
crop?: {
|
|
140
|
+
top: number
|
|
141
|
+
bottom: number
|
|
142
|
+
left: number
|
|
143
|
+
right: number
|
|
144
|
+
}
|
|
145
|
+
alt?: string
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare interface SanityImageWithAlt extends SanityImage {
|
|
149
|
+
alt: string
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export declare interface SeoFields {
|
|
153
|
+
_type: 'seoFields'
|
|
154
|
+
robots?: RobotsSettings
|
|
155
|
+
preview?: string
|
|
156
|
+
title?: string
|
|
157
|
+
description?: string
|
|
158
|
+
metaImage?: SanityImage
|
|
159
|
+
keywords?: string[]
|
|
160
|
+
canonicalUrl?: string
|
|
161
|
+
openGraph?: OpenGraphSettings
|
|
162
|
+
twitter?: TwitterCardSettings
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Usage in `sanity.config.ts` (or .js)
|
|
167
|
+
*
|
|
168
|
+
* ```ts
|
|
169
|
+
* import {defineConfig} from 'sanity'
|
|
170
|
+
* import {myPlugin} from 'sanity-plugin-seofields'
|
|
171
|
+
*
|
|
172
|
+
* export default defineConfig({
|
|
173
|
+
* // ...
|
|
174
|
+
* plugins: [seofields()],
|
|
175
|
+
* })
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
export declare const seofields: Plugin_2<void | MyPluginConfig>
|
|
179
|
+
|
|
180
|
+
export declare const seoFieldsSchema: {
|
|
181
|
+
type: 'object'
|
|
182
|
+
name: 'seoFields'
|
|
183
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
184
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export declare interface SeoValidationRules {
|
|
188
|
+
title: {
|
|
189
|
+
maxLength: number
|
|
190
|
+
warningLength: number
|
|
191
|
+
}
|
|
192
|
+
description: {
|
|
193
|
+
maxLength: number
|
|
194
|
+
warningLength: number
|
|
195
|
+
}
|
|
196
|
+
openGraphTitle: {
|
|
197
|
+
maxLength: number
|
|
198
|
+
}
|
|
199
|
+
openGraphDescription: {
|
|
200
|
+
maxLength: number
|
|
201
|
+
}
|
|
202
|
+
twitterTitle: {
|
|
203
|
+
maxLength: number
|
|
204
|
+
}
|
|
205
|
+
twitterDescription: {
|
|
206
|
+
maxLength: number
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export declare interface TwitterCardSettings {
|
|
211
|
+
_type: 'twitter'
|
|
212
|
+
card?: 'summary' | 'summary_large_image' | 'app' | 'player'
|
|
213
|
+
site?: string
|
|
214
|
+
title?: string
|
|
215
|
+
description?: string
|
|
216
|
+
image?: SanityImageWithAlt
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export declare const twitterSchema: {
|
|
220
|
+
type: 'object'
|
|
221
|
+
name: 'twitter'
|
|
222
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
223
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export {}
|