@quintype/seo 1.48.2-support-event-schema.5 → 1.49.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/CHANGELOG.md +7 -0
- package/dist/index.cjs.js +43 -10
- package/package.json +1 -1
- package/src/structured-data/structured-data-tags.js +52 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.49.0](https://github.com/quintype/quintype-node-seo/compare/v1.48.1...v1.49.0) (2025-04-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add event schema support when eventDetails exist in story data ([#567](https://github.com/quintype/quintype-node-seo/issues/567)) ([941b86e](https://github.com/quintype/quintype-node-seo/commit/941b86eedd93845fd7a295341a75bd667c35fc85))
|
|
11
|
+
|
|
5
12
|
### [1.48.1](https://github.com/quintype/quintype-node-seo/compare/v1.48.0...v1.48.1) (2024-12-17)
|
|
6
13
|
|
|
7
14
|
|
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 {
|
|
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:
|
|
920
|
-
offline:
|
|
921
|
-
mix:
|
|
930
|
+
online: 'https://schema.org/OnlineEventAttendanceMode',
|
|
931
|
+
offline: 'https://schema.org/OfflineEventAttendanceMode',
|
|
932
|
+
mix: 'https://schema.org/MixedEventAttendanceMode'
|
|
922
933
|
};
|
|
923
|
-
const
|
|
924
|
-
const
|
|
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
|
|
|
@@ -998,7 +1030,8 @@ function StructuredDataTags({ structuredData = {} }, config, pageType, response
|
|
|
998
1030
|
const isStructuredDataEmpty = Object.keys(structuredData).length === 0;
|
|
999
1031
|
const enableBreadcrumbList = get__default["default"](structuredData, ["enableBreadcrumbList"], true);
|
|
1000
1032
|
const structuredDataTags = get__default["default"](structuredData, ["structuredDataTags"], []);
|
|
1001
|
-
|
|
1033
|
+
const enableEventsData = get__default["default"](structuredData, ["enableEventsData"], null);
|
|
1034
|
+
const enableStorySeoEventsData = get__default["default"](story, ["enableSeoEventsData"], null);
|
|
1002
1035
|
let articleData = {};
|
|
1003
1036
|
|
|
1004
1037
|
if (!isStructuredDataEmpty) {
|
|
@@ -1024,8 +1057,8 @@ function StructuredDataTags({ structuredData = {} }, config, pageType, response
|
|
|
1024
1057
|
tags.push(ldJson("BreadcrumbList", generateBreadcrumbListData(pageType, publisherConfig, response.data)));
|
|
1025
1058
|
}
|
|
1026
1059
|
|
|
1027
|
-
if (
|
|
1028
|
-
tags.push(ldJson("Event", generateEventsSchema(story)));
|
|
1060
|
+
if (enableEventsData && pageType === "story-page" && enableStorySeoEventsData) {
|
|
1061
|
+
tags.push(ldJson("Event", generateEventsSchema(story, publisherConfig)));
|
|
1029
1062
|
}
|
|
1030
1063
|
|
|
1031
1064
|
if (!isStructuredDataEmpty && pageType === "story-page") {
|
package/package.json
CHANGED
|
@@ -399,16 +399,56 @@ function generateBreadcrumbListData(pageType = "", publisherConfig = {}, data =
|
|
|
399
399
|
return getSchemaBreadcrumbList(breadcrumbsDataList);
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
function generateEventsSchema(story = {}) {
|
|
403
|
-
const {
|
|
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:
|
|
406
|
-
offline:
|
|
407
|
-
mix:
|
|
416
|
+
online: 'https://schema.org/OnlineEventAttendanceMode',
|
|
417
|
+
offline: 'https://schema.org/OfflineEventAttendanceMode',
|
|
418
|
+
mix: 'https://schema.org/MixedEventAttendanceMode'
|
|
408
419
|
}
|
|
409
|
-
const
|
|
410
|
-
const
|
|
411
|
-
|
|
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
|
/**
|
|
@@ -484,7 +524,8 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
|
|
|
484
524
|
const isStructuredDataEmpty = Object.keys(structuredData).length === 0;
|
|
485
525
|
const enableBreadcrumbList = get(structuredData, ["enableBreadcrumbList"], true);
|
|
486
526
|
const structuredDataTags = get(structuredData, ["structuredDataTags"], []);
|
|
487
|
-
|
|
527
|
+
const enableEventsData = get(structuredData, ["enableEventsData"], null);
|
|
528
|
+
const enableStorySeoEventsData = get(story, ["enableSeoEventsData"], null);
|
|
488
529
|
let articleData = {};
|
|
489
530
|
|
|
490
531
|
if (!isStructuredDataEmpty) {
|
|
@@ -510,8 +551,8 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
|
|
|
510
551
|
tags.push(ldJson("BreadcrumbList", generateBreadcrumbListData(pageType, publisherConfig, response.data)));
|
|
511
552
|
}
|
|
512
553
|
|
|
513
|
-
if(
|
|
514
|
-
tags.push(ldJson("Event", generateEventsSchema(story)));
|
|
554
|
+
if(enableEventsData && pageType === "story-page" && enableStorySeoEventsData){
|
|
555
|
+
tags.push(ldJson("Event", generateEventsSchema(story, publisherConfig)));
|
|
515
556
|
}
|
|
516
557
|
|
|
517
558
|
if (!isStructuredDataEmpty && pageType === "story-page") {
|