@quintype/seo 1.48.1 → 1.48.2-support-event-schema-2.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/dist/index.cjs.js
CHANGED
|
@@ -913,6 +913,18 @@ function generateBreadcrumbListData(pageType = "", publisherConfig = {}, data =
|
|
|
913
913
|
return getSchemaBreadcrumbList(breadcrumbsDataList);
|
|
914
914
|
}
|
|
915
915
|
|
|
916
|
+
function generateEventsSchema(story = {}) {
|
|
917
|
+
const { location = "", startdate = "", enddate = "", mode = "offline", paidevent = false, organizertype = "Organization", organizername = "", organizeremail = "", organizerurl = "", organizertelephone = "" } = story.eventDetails || {};
|
|
918
|
+
const eventMode = {
|
|
919
|
+
online: "https://schema.org/OnlineEventAttendanceMode",
|
|
920
|
+
offline: "https://schema.org/OfflineEventAttendanceMode",
|
|
921
|
+
mix: "https://schema.org/MixedEventAttendanceMode"
|
|
922
|
+
};
|
|
923
|
+
const organizerData = organizername ? { Organizer: Object.assign({}, getSchemaType(organizertype), { name: organizername, url: organizerurl, email: organizeremail, telephone: organizertelephone }) } : {};
|
|
924
|
+
const eventsData = Object.assign({}, getSchemaContext, getSchemaType("Event"), { name: story.headline, description: story.subheadline || "", url: story.url, image: story["hero-image-s3-key"] || "", startDate: startdate, endDate: enddate, eventAttendanceMode: eventMode[mode], isAccessibleForFree: paidevent, eventStatus: "https://schema.org/EventScheduled", location: location }, organizerData);
|
|
925
|
+
return eventsData;
|
|
926
|
+
}
|
|
927
|
+
|
|
916
928
|
/**
|
|
917
929
|
* Options for a schema.org Organization
|
|
918
930
|
* Example
|
|
@@ -1012,6 +1024,10 @@ function StructuredDataTags({ structuredData = {} }, config, pageType, response
|
|
|
1012
1024
|
tags.push(ldJson("BreadcrumbList", generateBreadcrumbListData(pageType, publisherConfig, response.data)));
|
|
1013
1025
|
}
|
|
1014
1026
|
|
|
1027
|
+
if (structuredData.enableEventsData && pageType === "story-page" && story.enableSeoEventsData) {
|
|
1028
|
+
tags.push(ldJson("Event", generateEventsSchema(story)));
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1015
1031
|
if (!isStructuredDataEmpty && pageType === "story-page") {
|
|
1016
1032
|
const newsArticleTags = generateNewsArticleTags();
|
|
1017
1033
|
newsArticleTags ? tags.push(storyTags(), newsArticleTags) : tags.push(storyTags());
|
package/package.json
CHANGED
|
@@ -399,6 +399,18 @@ function generateBreadcrumbListData(pageType = "", publisherConfig = {}, data =
|
|
|
399
399
|
return getSchemaBreadcrumbList(breadcrumbsDataList);
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
+
function generateEventsSchema(story = {}) {
|
|
403
|
+
const {location = "", startdate = "", enddate = "", mode = "offline", paidevent = false, organizertype = "Organization", organizername = "", organizeremail="", organizerurl="", organizertelephone=""} = story.eventDetails || {};
|
|
404
|
+
const eventMode = {
|
|
405
|
+
online: "https://schema.org/OnlineEventAttendanceMode",
|
|
406
|
+
offline: "https://schema.org/OfflineEventAttendanceMode",
|
|
407
|
+
mix: "https://schema.org/MixedEventAttendanceMode"
|
|
408
|
+
}
|
|
409
|
+
const organizerData = organizername ? {Organizer : Object.assign({}, getSchemaType(organizertype), {name: organizername,url: organizerurl, email: organizeremail,telephone: organizertelephone})} : {}
|
|
410
|
+
const eventsData = Object.assign({}, getSchemaContext, getSchemaType("Event"), { name: story.headline, description: story.subheadline || "", url: story.url, image: story["hero-image-s3-key"] || "", startDate: startdate, endDate: enddate, eventAttendanceMode: eventMode[mode], isAccessibleForFree: paidevent, eventStatus: "https://schema.org/EventScheduled", location: location}, organizerData);
|
|
411
|
+
return eventsData;
|
|
412
|
+
}
|
|
413
|
+
|
|
402
414
|
/**
|
|
403
415
|
* Options for a schema.org Organization
|
|
404
416
|
* Example
|
|
@@ -498,6 +510,10 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
|
|
|
498
510
|
tags.push(ldJson("BreadcrumbList", generateBreadcrumbListData(pageType, publisherConfig, response.data)));
|
|
499
511
|
}
|
|
500
512
|
|
|
513
|
+
if(structuredData.enableEventsData && pageType === "story-page" && story.enableSeoEventsData){
|
|
514
|
+
tags.push(ldJson("Event", generateEventsSchema(story)));
|
|
515
|
+
}
|
|
516
|
+
|
|
501
517
|
if (!isStructuredDataEmpty && pageType === "story-page") {
|
|
502
518
|
const newsArticleTags = generateNewsArticleTags();
|
|
503
519
|
newsArticleTags ? tags.push(storyTags(), newsArticleTags) : tags.push(storyTags());
|