@masters-ws/react-seo 1.1.0 → 1.2.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/dist/chunk-QD5UVA5B.mjs +357 -0
- package/dist/core/index.d.mts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +129 -2
- package/dist/core/index.mjs +11 -1
- package/dist/index-BEY3UKjK.d.mts +538 -0
- package/dist/index-BEY3UKjK.d.ts +538 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +129 -2
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// src/core/schemas.ts
|
|
2
|
+
function generateOrganizationSchema(config) {
|
|
3
|
+
return {
|
|
4
|
+
"@context": "https://schema.org",
|
|
5
|
+
"@type": "Organization",
|
|
6
|
+
"name": config.name,
|
|
7
|
+
"url": config.url,
|
|
8
|
+
"logo": config.logo,
|
|
9
|
+
"sameAs": config.socialLinks || []
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function generateWebSiteSchema(config) {
|
|
13
|
+
return {
|
|
14
|
+
"@context": "https://schema.org",
|
|
15
|
+
"@type": "WebSite",
|
|
16
|
+
"name": config.name,
|
|
17
|
+
"url": config.url,
|
|
18
|
+
"potentialAction": {
|
|
19
|
+
"@type": "SearchAction",
|
|
20
|
+
"target": `${config.url}/search?q={search_term_string}`,
|
|
21
|
+
"query-input": "required name=search_term_string"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function generateArticleSchema(data, config) {
|
|
26
|
+
const org = generateOrganizationSchema(config);
|
|
27
|
+
return {
|
|
28
|
+
"@context": "https://schema.org",
|
|
29
|
+
"@type": "NewsArticle",
|
|
30
|
+
"headline": data.title,
|
|
31
|
+
"description": data.description,
|
|
32
|
+
"image": data.image || config.logo,
|
|
33
|
+
"datePublished": data.publishedTime,
|
|
34
|
+
"dateModified": data.modifiedTime || data.publishedTime,
|
|
35
|
+
"mainEntityOfPage": data.url,
|
|
36
|
+
"author": data.author ? {
|
|
37
|
+
"@type": "Person",
|
|
38
|
+
"name": data.author.name,
|
|
39
|
+
"url": data.author.url
|
|
40
|
+
} : org,
|
|
41
|
+
"publisher": org
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function generateProductSchema(data) {
|
|
45
|
+
return {
|
|
46
|
+
"@context": "https://schema.org",
|
|
47
|
+
"@type": "Product",
|
|
48
|
+
"name": data.name,
|
|
49
|
+
"description": data.description,
|
|
50
|
+
"image": data.image,
|
|
51
|
+
"sku": data.sku,
|
|
52
|
+
"brand": data.brand ? { "@type": "Brand", "name": data.brand } : void 0,
|
|
53
|
+
"offers": {
|
|
54
|
+
"@type": "Offer",
|
|
55
|
+
"url": data.url,
|
|
56
|
+
"priceCurrency": data.currency || "USD",
|
|
57
|
+
"price": data.price,
|
|
58
|
+
"availability": data.availability || "https://schema.org/InStock"
|
|
59
|
+
},
|
|
60
|
+
"aggregateRating": data.rating ? {
|
|
61
|
+
"@type": "AggregateRating",
|
|
62
|
+
"ratingValue": data.rating,
|
|
63
|
+
"reviewCount": data.reviewCount || 1
|
|
64
|
+
} : void 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function generateFAQSchema(questions) {
|
|
68
|
+
return {
|
|
69
|
+
"@context": "https://schema.org",
|
|
70
|
+
"@type": "FAQPage",
|
|
71
|
+
"mainEntity": questions.map((item) => ({
|
|
72
|
+
"@type": "Question",
|
|
73
|
+
"name": item.q,
|
|
74
|
+
"acceptedAnswer": {
|
|
75
|
+
"@type": "Answer",
|
|
76
|
+
"text": item.a
|
|
77
|
+
}
|
|
78
|
+
}))
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function generateBreadcrumbSchema(items) {
|
|
82
|
+
return {
|
|
83
|
+
"@context": "https://schema.org",
|
|
84
|
+
"@type": "BreadcrumbList",
|
|
85
|
+
"itemListElement": items.map((item, index) => ({
|
|
86
|
+
"@type": "ListItem",
|
|
87
|
+
"position": index + 1,
|
|
88
|
+
"name": item.name,
|
|
89
|
+
"item": item.item
|
|
90
|
+
}))
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function generateVideoSchema(data) {
|
|
94
|
+
return {
|
|
95
|
+
"@context": "https://schema.org",
|
|
96
|
+
"@type": "VideoObject",
|
|
97
|
+
"name": data.name,
|
|
98
|
+
"description": data.description,
|
|
99
|
+
"thumbnailUrl": data.thumbnailUrl,
|
|
100
|
+
"uploadDate": data.uploadDate,
|
|
101
|
+
"duration": data.duration,
|
|
102
|
+
"contentUrl": data.contentUrl,
|
|
103
|
+
"embedUrl": data.embedUrl
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function generateEventSchema(data) {
|
|
107
|
+
const isOnline = data.location && "url" in data.location;
|
|
108
|
+
return {
|
|
109
|
+
"@context": "https://schema.org",
|
|
110
|
+
"@type": "Event",
|
|
111
|
+
"name": data.name,
|
|
112
|
+
"description": data.description,
|
|
113
|
+
"startDate": data.startDate,
|
|
114
|
+
"endDate": data.endDate,
|
|
115
|
+
"eventAttendanceMode": isOnline ? "https://schema.org/OnlineEventAttendanceMode" : "https://schema.org/OfflineEventAttendanceMode",
|
|
116
|
+
"location": isOnline ? {
|
|
117
|
+
"@type": "VirtualLocation",
|
|
118
|
+
"url": data.location.url
|
|
119
|
+
} : data.location ? {
|
|
120
|
+
"@type": "Place",
|
|
121
|
+
"name": data.location.name,
|
|
122
|
+
"address": data.location.address
|
|
123
|
+
} : void 0,
|
|
124
|
+
"image": data.image,
|
|
125
|
+
"offers": data.offers ? {
|
|
126
|
+
"@type": "Offer",
|
|
127
|
+
"price": data.offers.price,
|
|
128
|
+
"priceCurrency": data.offers.currency,
|
|
129
|
+
"url": data.offers.url
|
|
130
|
+
} : void 0
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function generateLocalBusinessSchema(data) {
|
|
134
|
+
return {
|
|
135
|
+
"@context": "https://schema.org",
|
|
136
|
+
"@type": "LocalBusiness",
|
|
137
|
+
"name": data.name,
|
|
138
|
+
"description": data.description,
|
|
139
|
+
"image": data.image,
|
|
140
|
+
"telephone": data.telephone,
|
|
141
|
+
"address": {
|
|
142
|
+
"@type": "PostalAddress",
|
|
143
|
+
"streetAddress": data.address.street,
|
|
144
|
+
"addressLocality": data.address.city,
|
|
145
|
+
"addressRegion": data.address.region,
|
|
146
|
+
"postalCode": data.address.postalCode,
|
|
147
|
+
"addressCountry": data.address.country
|
|
148
|
+
},
|
|
149
|
+
"geo": data.geo ? {
|
|
150
|
+
"@type": "GeoCoordinates",
|
|
151
|
+
"latitude": data.geo.lat,
|
|
152
|
+
"longitude": data.geo.lng
|
|
153
|
+
} : void 0,
|
|
154
|
+
"openingHours": data.openingHours,
|
|
155
|
+
"priceRange": data.priceRange
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function generateSoftwareSchema(data) {
|
|
159
|
+
return {
|
|
160
|
+
"@context": "https://schema.org",
|
|
161
|
+
"@type": "SoftwareApplication",
|
|
162
|
+
"name": data.name,
|
|
163
|
+
"description": data.description,
|
|
164
|
+
"operatingSystem": data.operatingSystem,
|
|
165
|
+
"applicationCategory": data.applicationCategory,
|
|
166
|
+
"offers": data.offers ? {
|
|
167
|
+
"@type": "Offer",
|
|
168
|
+
"price": data.offers.price,
|
|
169
|
+
"priceCurrency": data.offers.currency
|
|
170
|
+
} : void 0,
|
|
171
|
+
"aggregateRating": data.rating ? {
|
|
172
|
+
"@type": "AggregateRating",
|
|
173
|
+
"ratingValue": data.rating,
|
|
174
|
+
"reviewCount": data.reviewCount || 1
|
|
175
|
+
} : void 0,
|
|
176
|
+
"downloadUrl": data.downloadUrl,
|
|
177
|
+
"screenshot": data.screenshot
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function generateBookSchema(data) {
|
|
181
|
+
return {
|
|
182
|
+
"@context": "https://schema.org",
|
|
183
|
+
"@type": "Book",
|
|
184
|
+
"name": data.name,
|
|
185
|
+
"author": typeof data.author === "string" ? {
|
|
186
|
+
"@type": "Person",
|
|
187
|
+
"name": data.author
|
|
188
|
+
} : {
|
|
189
|
+
"@type": "Person",
|
|
190
|
+
"name": data.author.name,
|
|
191
|
+
"url": data.author.url
|
|
192
|
+
},
|
|
193
|
+
"description": data.description,
|
|
194
|
+
"isbn": data.isbn,
|
|
195
|
+
"numberOfPages": data.numberOfPages,
|
|
196
|
+
"publisher": data.publisher ? {
|
|
197
|
+
"@type": "Organization",
|
|
198
|
+
"name": data.publisher
|
|
199
|
+
} : void 0,
|
|
200
|
+
"datePublished": data.datePublished,
|
|
201
|
+
"image": data.image,
|
|
202
|
+
"inLanguage": data.inLanguage,
|
|
203
|
+
"genre": data.genre
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function generateMovieSchema(data) {
|
|
207
|
+
return {
|
|
208
|
+
"@context": "https://schema.org",
|
|
209
|
+
"@type": "Movie",
|
|
210
|
+
"name": data.name,
|
|
211
|
+
"description": data.description,
|
|
212
|
+
"image": data.image,
|
|
213
|
+
"director": data.director ? {
|
|
214
|
+
"@type": "Person",
|
|
215
|
+
"name": data.director
|
|
216
|
+
} : void 0,
|
|
217
|
+
"actor": data.actor?.map((name) => ({
|
|
218
|
+
"@type": "Person",
|
|
219
|
+
"name": name
|
|
220
|
+
})),
|
|
221
|
+
"dateCreated": data.dateCreated,
|
|
222
|
+
"duration": data.duration,
|
|
223
|
+
"genre": data.genre,
|
|
224
|
+
"aggregateRating": data.rating ? {
|
|
225
|
+
"@type": "AggregateRating",
|
|
226
|
+
"ratingValue": data.rating,
|
|
227
|
+
"reviewCount": data.reviewCount || 1
|
|
228
|
+
} : void 0
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function generatePodcastSchema(data) {
|
|
232
|
+
return {
|
|
233
|
+
"@context": "https://schema.org",
|
|
234
|
+
"@type": "PodcastSeries",
|
|
235
|
+
"name": data.name,
|
|
236
|
+
"description": data.description,
|
|
237
|
+
"image": data.image,
|
|
238
|
+
"author": data.author ? {
|
|
239
|
+
"@type": "Person",
|
|
240
|
+
"name": data.author
|
|
241
|
+
} : void 0,
|
|
242
|
+
"webFeed": data.webFeed,
|
|
243
|
+
"url": data.url,
|
|
244
|
+
"genre": data.genre
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function generatePodcastEpisodeSchema(data) {
|
|
248
|
+
return {
|
|
249
|
+
"@context": "https://schema.org",
|
|
250
|
+
"@type": "PodcastEpisode",
|
|
251
|
+
"name": data.name,
|
|
252
|
+
"description": data.description,
|
|
253
|
+
"datePublished": data.datePublished,
|
|
254
|
+
"timeRequired": data.duration,
|
|
255
|
+
"url": data.url,
|
|
256
|
+
"associatedMedia": data.audio ? {
|
|
257
|
+
"@type": "AudioObject",
|
|
258
|
+
"contentUrl": data.audio
|
|
259
|
+
} : void 0,
|
|
260
|
+
"partOfSeries": data.partOfSeries ? {
|
|
261
|
+
"@type": "PodcastSeries",
|
|
262
|
+
"name": data.partOfSeries.name,
|
|
263
|
+
"url": data.partOfSeries.url
|
|
264
|
+
} : void 0
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// src/core/metadata.ts
|
|
269
|
+
function toNextMetadata(props, config) {
|
|
270
|
+
const title = props.title ? `${props.title} | ${config.name}` : config.name;
|
|
271
|
+
const description = props.description || config.description;
|
|
272
|
+
const url = props.canonical || config.url;
|
|
273
|
+
const image = props.image || config.logo;
|
|
274
|
+
const metadata = {
|
|
275
|
+
title,
|
|
276
|
+
description,
|
|
277
|
+
keywords: props.keywords,
|
|
278
|
+
robots: props.noindex ? "noindex, nofollow" : props.robots || "index, follow",
|
|
279
|
+
alternates: {
|
|
280
|
+
canonical: props.noindex ? void 0 : url
|
|
281
|
+
},
|
|
282
|
+
openGraph: {
|
|
283
|
+
title: props.ogTitle || title,
|
|
284
|
+
description: props.ogDescription || description,
|
|
285
|
+
url,
|
|
286
|
+
siteName: config.name,
|
|
287
|
+
images: props.ogImage || image ? [{
|
|
288
|
+
url: props.ogImage || image,
|
|
289
|
+
width: props.ogImageWidth || 1200,
|
|
290
|
+
height: props.ogImageHeight || 630,
|
|
291
|
+
alt: props.ogImageAlt || title
|
|
292
|
+
}] : [],
|
|
293
|
+
type: props.ogType || (props.type === "article" ? "article" : "website"),
|
|
294
|
+
locale: props.ogLocale || config.language || "ar_SA"
|
|
295
|
+
},
|
|
296
|
+
twitter: {
|
|
297
|
+
card: props.twitterCard || "summary_large_image",
|
|
298
|
+
title: props.twitterTitle || title,
|
|
299
|
+
description: props.twitterDescription || description,
|
|
300
|
+
images: props.twitterImage || image ? [{
|
|
301
|
+
url: props.twitterImage || image,
|
|
302
|
+
alt: props.twitterImageAlt || title
|
|
303
|
+
}] : [],
|
|
304
|
+
site: config.twitterHandle,
|
|
305
|
+
creator: config.twitterHandle
|
|
306
|
+
},
|
|
307
|
+
other: {}
|
|
308
|
+
};
|
|
309
|
+
if (props.alternates && props.alternates.length > 0) {
|
|
310
|
+
const languages = {};
|
|
311
|
+
props.alternates.forEach((alt) => {
|
|
312
|
+
languages[alt.hreflang] = alt.href;
|
|
313
|
+
});
|
|
314
|
+
metadata.alternates.languages = languages;
|
|
315
|
+
}
|
|
316
|
+
metadata.appleWebApp = {
|
|
317
|
+
capable: true,
|
|
318
|
+
title: config.name,
|
|
319
|
+
statusBarStyle: "default"
|
|
320
|
+
};
|
|
321
|
+
if (config.themeColor) metadata.themeColor = config.themeColor;
|
|
322
|
+
if (config.manifest) metadata.manifest = config.manifest;
|
|
323
|
+
return metadata;
|
|
324
|
+
}
|
|
325
|
+
function generatePaginationLinks(baseUrl, currentPage, totalPages) {
|
|
326
|
+
const hasNext = currentPage < totalPages;
|
|
327
|
+
const hasPrev = currentPage > 1;
|
|
328
|
+
const cleanBase = baseUrl.split("?")[0];
|
|
329
|
+
return {
|
|
330
|
+
next: hasNext ? `${cleanBase}?page=${currentPage + 1}` : void 0,
|
|
331
|
+
prev: hasPrev ? currentPage === 2 ? cleanBase : `${cleanBase}?page=${currentPage - 1}` : void 0,
|
|
332
|
+
canonical: currentPage === 1 ? cleanBase : `${cleanBase}?page=${currentPage}`
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function generatePaginatedTitle(title, page, suffix = "\u0635\u0641\u062D\u0629") {
|
|
336
|
+
return page > 1 ? `${title} - ${suffix} ${page}` : title;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export {
|
|
340
|
+
generateOrganizationSchema,
|
|
341
|
+
generateWebSiteSchema,
|
|
342
|
+
generateArticleSchema,
|
|
343
|
+
generateProductSchema,
|
|
344
|
+
generateFAQSchema,
|
|
345
|
+
generateBreadcrumbSchema,
|
|
346
|
+
generateVideoSchema,
|
|
347
|
+
generateEventSchema,
|
|
348
|
+
generateLocalBusinessSchema,
|
|
349
|
+
generateSoftwareSchema,
|
|
350
|
+
generateBookSchema,
|
|
351
|
+
generateMovieSchema,
|
|
352
|
+
generatePodcastSchema,
|
|
353
|
+
generatePodcastEpisodeSchema,
|
|
354
|
+
toNextMetadata,
|
|
355
|
+
generatePaginationLinks,
|
|
356
|
+
generatePaginatedTitle
|
|
357
|
+
};
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { g as generateArticleSchema, b as
|
|
1
|
+
export { g as generateArticleSchema, b as generateBookSchema, c as generateBreadcrumbSchema, d as generateEventSchema, e as generateFAQSchema, f as generateLocalBusinessSchema, h as generateMovieSchema, i as generateOrganizationSchema, j as generatePaginatedTitle, k as generatePaginationLinks, l as generatePodcastEpisodeSchema, m as generatePodcastSchema, n as generateProductSchema, o as generateSoftwareSchema, p as generateVideoSchema, q as generateWebSiteSchema, t as toNextMetadata } from '../index-BEY3UKjK.mjs';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { g as generateArticleSchema, b as
|
|
1
|
+
export { g as generateArticleSchema, b as generateBookSchema, c as generateBreadcrumbSchema, d as generateEventSchema, e as generateFAQSchema, f as generateLocalBusinessSchema, h as generateMovieSchema, i as generateOrganizationSchema, j as generatePaginatedTitle, k as generatePaginationLinks, l as generatePodcastEpisodeSchema, m as generatePodcastSchema, n as generateProductSchema, o as generateSoftwareSchema, p as generateVideoSchema, q as generateWebSiteSchema, t as toNextMetadata } from '../index-BEY3UKjK.js';
|
package/dist/core/index.js
CHANGED
|
@@ -21,14 +21,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var core_exports = {};
|
|
22
22
|
__export(core_exports, {
|
|
23
23
|
generateArticleSchema: () => generateArticleSchema,
|
|
24
|
+
generateBookSchema: () => generateBookSchema,
|
|
24
25
|
generateBreadcrumbSchema: () => generateBreadcrumbSchema,
|
|
25
26
|
generateEventSchema: () => generateEventSchema,
|
|
26
27
|
generateFAQSchema: () => generateFAQSchema,
|
|
27
28
|
generateLocalBusinessSchema: () => generateLocalBusinessSchema,
|
|
29
|
+
generateMovieSchema: () => generateMovieSchema,
|
|
28
30
|
generateOrganizationSchema: () => generateOrganizationSchema,
|
|
29
31
|
generatePaginatedTitle: () => generatePaginatedTitle,
|
|
30
32
|
generatePaginationLinks: () => generatePaginationLinks,
|
|
33
|
+
generatePodcastEpisodeSchema: () => generatePodcastEpisodeSchema,
|
|
34
|
+
generatePodcastSchema: () => generatePodcastSchema,
|
|
31
35
|
generateProductSchema: () => generateProductSchema,
|
|
36
|
+
generateSoftwareSchema: () => generateSoftwareSchema,
|
|
32
37
|
generateVideoSchema: () => generateVideoSchema,
|
|
33
38
|
generateWebSiteSchema: () => generateWebSiteSchema,
|
|
34
39
|
toNextMetadata: () => toNextMetadata
|
|
@@ -192,6 +197,115 @@ function generateLocalBusinessSchema(data) {
|
|
|
192
197
|
"priceRange": data.priceRange
|
|
193
198
|
};
|
|
194
199
|
}
|
|
200
|
+
function generateSoftwareSchema(data) {
|
|
201
|
+
return {
|
|
202
|
+
"@context": "https://schema.org",
|
|
203
|
+
"@type": "SoftwareApplication",
|
|
204
|
+
"name": data.name,
|
|
205
|
+
"description": data.description,
|
|
206
|
+
"operatingSystem": data.operatingSystem,
|
|
207
|
+
"applicationCategory": data.applicationCategory,
|
|
208
|
+
"offers": data.offers ? {
|
|
209
|
+
"@type": "Offer",
|
|
210
|
+
"price": data.offers.price,
|
|
211
|
+
"priceCurrency": data.offers.currency
|
|
212
|
+
} : void 0,
|
|
213
|
+
"aggregateRating": data.rating ? {
|
|
214
|
+
"@type": "AggregateRating",
|
|
215
|
+
"ratingValue": data.rating,
|
|
216
|
+
"reviewCount": data.reviewCount || 1
|
|
217
|
+
} : void 0,
|
|
218
|
+
"downloadUrl": data.downloadUrl,
|
|
219
|
+
"screenshot": data.screenshot
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function generateBookSchema(data) {
|
|
223
|
+
return {
|
|
224
|
+
"@context": "https://schema.org",
|
|
225
|
+
"@type": "Book",
|
|
226
|
+
"name": data.name,
|
|
227
|
+
"author": typeof data.author === "string" ? {
|
|
228
|
+
"@type": "Person",
|
|
229
|
+
"name": data.author
|
|
230
|
+
} : {
|
|
231
|
+
"@type": "Person",
|
|
232
|
+
"name": data.author.name,
|
|
233
|
+
"url": data.author.url
|
|
234
|
+
},
|
|
235
|
+
"description": data.description,
|
|
236
|
+
"isbn": data.isbn,
|
|
237
|
+
"numberOfPages": data.numberOfPages,
|
|
238
|
+
"publisher": data.publisher ? {
|
|
239
|
+
"@type": "Organization",
|
|
240
|
+
"name": data.publisher
|
|
241
|
+
} : void 0,
|
|
242
|
+
"datePublished": data.datePublished,
|
|
243
|
+
"image": data.image,
|
|
244
|
+
"inLanguage": data.inLanguage,
|
|
245
|
+
"genre": data.genre
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function generateMovieSchema(data) {
|
|
249
|
+
return {
|
|
250
|
+
"@context": "https://schema.org",
|
|
251
|
+
"@type": "Movie",
|
|
252
|
+
"name": data.name,
|
|
253
|
+
"description": data.description,
|
|
254
|
+
"image": data.image,
|
|
255
|
+
"director": data.director ? {
|
|
256
|
+
"@type": "Person",
|
|
257
|
+
"name": data.director
|
|
258
|
+
} : void 0,
|
|
259
|
+
"actor": data.actor?.map((name) => ({
|
|
260
|
+
"@type": "Person",
|
|
261
|
+
"name": name
|
|
262
|
+
})),
|
|
263
|
+
"dateCreated": data.dateCreated,
|
|
264
|
+
"duration": data.duration,
|
|
265
|
+
"genre": data.genre,
|
|
266
|
+
"aggregateRating": data.rating ? {
|
|
267
|
+
"@type": "AggregateRating",
|
|
268
|
+
"ratingValue": data.rating,
|
|
269
|
+
"reviewCount": data.reviewCount || 1
|
|
270
|
+
} : void 0
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function generatePodcastSchema(data) {
|
|
274
|
+
return {
|
|
275
|
+
"@context": "https://schema.org",
|
|
276
|
+
"@type": "PodcastSeries",
|
|
277
|
+
"name": data.name,
|
|
278
|
+
"description": data.description,
|
|
279
|
+
"image": data.image,
|
|
280
|
+
"author": data.author ? {
|
|
281
|
+
"@type": "Person",
|
|
282
|
+
"name": data.author
|
|
283
|
+
} : void 0,
|
|
284
|
+
"webFeed": data.webFeed,
|
|
285
|
+
"url": data.url,
|
|
286
|
+
"genre": data.genre
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function generatePodcastEpisodeSchema(data) {
|
|
290
|
+
return {
|
|
291
|
+
"@context": "https://schema.org",
|
|
292
|
+
"@type": "PodcastEpisode",
|
|
293
|
+
"name": data.name,
|
|
294
|
+
"description": data.description,
|
|
295
|
+
"datePublished": data.datePublished,
|
|
296
|
+
"timeRequired": data.duration,
|
|
297
|
+
"url": data.url,
|
|
298
|
+
"associatedMedia": data.audio ? {
|
|
299
|
+
"@type": "AudioObject",
|
|
300
|
+
"contentUrl": data.audio
|
|
301
|
+
} : void 0,
|
|
302
|
+
"partOfSeries": data.partOfSeries ? {
|
|
303
|
+
"@type": "PodcastSeries",
|
|
304
|
+
"name": data.partOfSeries.name,
|
|
305
|
+
"url": data.partOfSeries.url
|
|
306
|
+
} : void 0
|
|
307
|
+
};
|
|
308
|
+
}
|
|
195
309
|
|
|
196
310
|
// src/core/metadata.ts
|
|
197
311
|
function toNextMetadata(props, config) {
|
|
@@ -212,7 +326,12 @@ function toNextMetadata(props, config) {
|
|
|
212
326
|
description: props.ogDescription || description,
|
|
213
327
|
url,
|
|
214
328
|
siteName: config.name,
|
|
215
|
-
images: props.ogImage || image ? [{
|
|
329
|
+
images: props.ogImage || image ? [{
|
|
330
|
+
url: props.ogImage || image,
|
|
331
|
+
width: props.ogImageWidth || 1200,
|
|
332
|
+
height: props.ogImageHeight || 630,
|
|
333
|
+
alt: props.ogImageAlt || title
|
|
334
|
+
}] : [],
|
|
216
335
|
type: props.ogType || (props.type === "article" ? "article" : "website"),
|
|
217
336
|
locale: props.ogLocale || config.language || "ar_SA"
|
|
218
337
|
},
|
|
@@ -220,7 +339,10 @@ function toNextMetadata(props, config) {
|
|
|
220
339
|
card: props.twitterCard || "summary_large_image",
|
|
221
340
|
title: props.twitterTitle || title,
|
|
222
341
|
description: props.twitterDescription || description,
|
|
223
|
-
images: props.twitterImage || image ? [
|
|
342
|
+
images: props.twitterImage || image ? [{
|
|
343
|
+
url: props.twitterImage || image,
|
|
344
|
+
alt: props.twitterImageAlt || title
|
|
345
|
+
}] : [],
|
|
224
346
|
site: config.twitterHandle,
|
|
225
347
|
creator: config.twitterHandle
|
|
226
348
|
},
|
|
@@ -258,14 +380,19 @@ function generatePaginatedTitle(title, page, suffix = "\u0635\u0641\u062D\u0629"
|
|
|
258
380
|
// Annotate the CommonJS export names for ESM import in node:
|
|
259
381
|
0 && (module.exports = {
|
|
260
382
|
generateArticleSchema,
|
|
383
|
+
generateBookSchema,
|
|
261
384
|
generateBreadcrumbSchema,
|
|
262
385
|
generateEventSchema,
|
|
263
386
|
generateFAQSchema,
|
|
264
387
|
generateLocalBusinessSchema,
|
|
388
|
+
generateMovieSchema,
|
|
265
389
|
generateOrganizationSchema,
|
|
266
390
|
generatePaginatedTitle,
|
|
267
391
|
generatePaginationLinks,
|
|
392
|
+
generatePodcastEpisodeSchema,
|
|
393
|
+
generatePodcastSchema,
|
|
268
394
|
generateProductSchema,
|
|
395
|
+
generateSoftwareSchema,
|
|
269
396
|
generateVideoSchema,
|
|
270
397
|
generateWebSiteSchema,
|
|
271
398
|
toNextMetadata
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateArticleSchema,
|
|
3
|
+
generateBookSchema,
|
|
3
4
|
generateBreadcrumbSchema,
|
|
4
5
|
generateEventSchema,
|
|
5
6
|
generateFAQSchema,
|
|
6
7
|
generateLocalBusinessSchema,
|
|
8
|
+
generateMovieSchema,
|
|
7
9
|
generateOrganizationSchema,
|
|
8
10
|
generatePaginatedTitle,
|
|
9
11
|
generatePaginationLinks,
|
|
12
|
+
generatePodcastEpisodeSchema,
|
|
13
|
+
generatePodcastSchema,
|
|
10
14
|
generateProductSchema,
|
|
15
|
+
generateSoftwareSchema,
|
|
11
16
|
generateVideoSchema,
|
|
12
17
|
generateWebSiteSchema,
|
|
13
18
|
toNextMetadata
|
|
14
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-QD5UVA5B.mjs";
|
|
15
20
|
export {
|
|
16
21
|
generateArticleSchema,
|
|
22
|
+
generateBookSchema,
|
|
17
23
|
generateBreadcrumbSchema,
|
|
18
24
|
generateEventSchema,
|
|
19
25
|
generateFAQSchema,
|
|
20
26
|
generateLocalBusinessSchema,
|
|
27
|
+
generateMovieSchema,
|
|
21
28
|
generateOrganizationSchema,
|
|
22
29
|
generatePaginatedTitle,
|
|
23
30
|
generatePaginationLinks,
|
|
31
|
+
generatePodcastEpisodeSchema,
|
|
32
|
+
generatePodcastSchema,
|
|
24
33
|
generateProductSchema,
|
|
34
|
+
generateSoftwareSchema,
|
|
25
35
|
generateVideoSchema,
|
|
26
36
|
generateWebSiteSchema,
|
|
27
37
|
toNextMetadata
|