@quintype/seo 1.48.2-support-event-schema.5 → 1.48.2-support-event-schema.6

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,15 +913,47 @@ 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 || {};
916
+ function generateEventsSchema(story = {}, publisherConfig = {}) {
917
+ const {
918
+ location = '',
919
+ startdate = '',
920
+ enddate = '',
921
+ mode = 'offline',
922
+ paidevent = false,
923
+ organizertype = 'Organization',
924
+ organizername = '',
925
+ organizeremail = '',
926
+ organizerurl = '',
927
+ organizertelephone = ''
928
+ } = story.eventDetails || {};
918
929
  const eventMode = {
919
- online: "https://schema.org/OnlineEventAttendanceMode",
920
- offline: "https://schema.org/OfflineEventAttendanceMode",
921
- mix: "https://schema.org/MixedEventAttendanceMode"
930
+ online: 'https://schema.org/OnlineEventAttendanceMode',
931
+ offline: 'https://schema.org/OfflineEventAttendanceMode',
932
+ mix: 'https://schema.org/MixedEventAttendanceMode'
922
933
  };
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);
934
+ const imageWidth = 1200;
935
+ const imageHeight = 675;
936
+ const image = imageUrl(publisherConfig, story['hero-image-s3-key'], imageWidth, imageHeight);
937
+ const organizerData = organizername ? {
938
+ Organizer: Object.assign({}, getSchemaType(organizertype), {
939
+ name: organizername,
940
+ url: organizerurl,
941
+ email: organizeremail,
942
+ telephone: organizertelephone
943
+ })
944
+ } : {};
945
+ const eventsData = Object.assign({}, getSchemaContext, getSchemaType('Event'), {
946
+ name: story.headline,
947
+ description: story.subheadline || '',
948
+ url: story.url,
949
+ image: image,
950
+ startDate: startdate,
951
+ endDate: enddate,
952
+ eventAttendanceMode: eventMode[mode],
953
+ isAccessibleForFree: paidevent,
954
+ eventStatus: 'https://schema.org/EventScheduled',
955
+ location: location
956
+ }, organizerData);
925
957
  return eventsData;
926
958
  }
927
959
 
@@ -1025,7 +1057,7 @@ function StructuredDataTags({ structuredData = {} }, config, pageType, response
1025
1057
  }
1026
1058
 
1027
1059
  if (structuredData.enableEventsData && pageType === "story-page" && story.enableSeoEventsData) {
1028
- tags.push(ldJson("Event", generateEventsSchema(story)));
1060
+ tags.push(ldJson("Event", generateEventsSchema(story, publisherConfig)));
1029
1061
  }
1030
1062
 
1031
1063
  if (!isStructuredDataEmpty && pageType === "story-page") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.48.2-support-event-schema.5",
3
+ "version": "1.48.2-support-event-schema.6",
4
4
  "description": "SEO Modules for Quintype",
5
5
  "main": "dist/index.cjs.js",
6
6
  "repository": "https://github.com/quintype/quintype-node-seo",
@@ -399,16 +399,56 @@ 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 || {};
402
+ function generateEventsSchema (story = {}, publisherConfig = {}) {
403
+ const {
404
+ location = '',
405
+ startdate = '',
406
+ enddate = '',
407
+ mode = 'offline',
408
+ paidevent = false,
409
+ organizertype = 'Organization',
410
+ organizername = '',
411
+ organizeremail = '',
412
+ organizerurl = '',
413
+ organizertelephone = ''
414
+ } = story.eventDetails || {}
404
415
  const eventMode = {
405
- online: "https://schema.org/OnlineEventAttendanceMode",
406
- offline: "https://schema.org/OfflineEventAttendanceMode",
407
- mix: "https://schema.org/MixedEventAttendanceMode"
416
+ online: 'https://schema.org/OnlineEventAttendanceMode',
417
+ offline: 'https://schema.org/OfflineEventAttendanceMode',
418
+ mix: 'https://schema.org/MixedEventAttendanceMode'
408
419
  }
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;
420
+ const imageWidth = 1200
421
+ const imageHeight = 675
422
+ const image = imageUrl(publisherConfig, story['hero-image-s3-key'], imageWidth, imageHeight)
423
+ const organizerData = organizername
424
+ ? {
425
+ Organizer: Object.assign({}, getSchemaType(organizertype), {
426
+ name: organizername,
427
+ url: organizerurl,
428
+ email: organizeremail,
429
+ telephone: organizertelephone
430
+ })
431
+ }
432
+ : {}
433
+ const eventsData = Object.assign(
434
+ {},
435
+ getSchemaContext,
436
+ getSchemaType('Event'),
437
+ {
438
+ name: story.headline,
439
+ description: story.subheadline || '',
440
+ url: story.url,
441
+ image: image,
442
+ startDate: startdate,
443
+ endDate: enddate,
444
+ eventAttendanceMode: eventMode[mode],
445
+ isAccessibleForFree: paidevent,
446
+ eventStatus: 'https://schema.org/EventScheduled',
447
+ location: location
448
+ },
449
+ organizerData
450
+ )
451
+ return eventsData
412
452
  }
413
453
 
414
454
  /**
@@ -511,7 +551,7 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
511
551
  }
512
552
 
513
553
  if(structuredData.enableEventsData && pageType === "story-page" && story.enableSeoEventsData){
514
- tags.push(ldJson("Event", generateEventsSchema(story)));
554
+ tags.push(ldJson("Event", generateEventsSchema(story, publisherConfig)));
515
555
  }
516
556
 
517
557
  if (!isStructuredDataEmpty && pageType === "story-page") {