@quintype/seo 1.50.0 → 1.50.1-schema-changes-2026.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 +11 -11
- package/package.json +1 -1
- package/src/generate-common-seo.js +0 -2
- package/src/structured-data/schema.js +2 -2
- package/src/structured-data/structured-data-tags.js +9 -5
- package/test/generate_common_seo_test.js +0 -6
- package/test/structured_data_tags_test.js +60 -60
package/dist/index.cjs.js
CHANGED
|
@@ -206,9 +206,7 @@ function generateStaticData(config) {
|
|
|
206
206
|
function generateImageObject(config = {}) {
|
|
207
207
|
const { "theme-attributes": themeConfig = {} } = config;
|
|
208
208
|
return {
|
|
209
|
-
"@context": "http://schema.org",
|
|
210
209
|
"@type": "ImageObject",
|
|
211
|
-
author: config["publisher-name"],
|
|
212
210
|
contentUrl: themeConfig.logo,
|
|
213
211
|
url: themeConfig.logo,
|
|
214
212
|
name: "logo",
|
|
@@ -460,7 +458,7 @@ function StaticTags(seoConfig, config, pageType, data, { url }) {
|
|
|
460
458
|
return objectToTags(seoConfig.staticTags || {});
|
|
461
459
|
}
|
|
462
460
|
|
|
463
|
-
const getSchemaContext = { "@context": "
|
|
461
|
+
const getSchemaContext = { "@context": "https://schema.org" };
|
|
464
462
|
|
|
465
463
|
function getSchemaType(type) {
|
|
466
464
|
return { "@type": type };
|
|
@@ -499,7 +497,7 @@ function getSchemaBlogPosting(card = {}, headline = "", image = "", structuredDa
|
|
|
499
497
|
function getSchemaPublisher(organization, orgUrl) {
|
|
500
498
|
const id = { id: orgUrl };
|
|
501
499
|
return {
|
|
502
|
-
publisher: Object.assign({}, getSchemaType("
|
|
500
|
+
publisher: Object.assign({}, organization, id, getSchemaType("NewsMediaOrganization"))
|
|
503
501
|
};
|
|
504
502
|
}
|
|
505
503
|
|
|
@@ -587,7 +585,7 @@ function generateTagsForEntity(entity, ldJson) {
|
|
|
587
585
|
}
|
|
588
586
|
|
|
589
587
|
function getLdJsonFields(type, fields) {
|
|
590
|
-
return Object.assign({},
|
|
588
|
+
return Object.assign({}, getSchemaContext, getSchemaType(type), fields);
|
|
591
589
|
}
|
|
592
590
|
|
|
593
591
|
function ldJson(type, fields) {
|
|
@@ -610,7 +608,7 @@ function imageUrl(publisherConfig, s3Key, width, height) {
|
|
|
610
608
|
function generateCommonData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
|
|
611
609
|
const storyUrl = story.url || `${publisherConfig["sketches-host"]}/${story.slug}`;
|
|
612
610
|
const orgUrl = get__default["default"](structuredData, ["organization", "url"], "");
|
|
613
|
-
const mainEntityUrl = Object.keys(story).length
|
|
611
|
+
const mainEntityUrl = Object.keys(story).length ? storyUrl : get__default["default"](structuredData, ["organization", "url"], "");
|
|
614
612
|
const imageWidth = 1200;
|
|
615
613
|
const imageHeight = 675;
|
|
616
614
|
return Object.assign({}, {
|
|
@@ -670,18 +668,21 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
|
|
|
670
668
|
const isAccessibleForFree = storyAccessType ? {} : { isAccessibleForFree: storyAccessType };
|
|
671
669
|
const metadata = get__default["default"](story, ["metadata"], {});
|
|
672
670
|
const sponsor = metadata.hasOwnProperty("sponsored-by") ? { sponsor: { name: metadata["sponsored-by"] } } : {};
|
|
671
|
+
const inLanguage = get__default["default"](publisherConfig, ["language", "iso-code"], "");
|
|
672
|
+
const description = get__default["default"](story, ["seo", "meta-description"]) || get__default["default"](story, ["subheadline"]) || get__default["default"](story, ["headline"]);
|
|
673
673
|
|
|
674
674
|
return Object.assign({}, generateCommonData(structuredData, story, publisherConfig, timezone), {
|
|
675
|
+
description,
|
|
675
676
|
author: authorData(authors, authorSchema, publisherConfig),
|
|
676
677
|
keywords: metaKeywords.join(","),
|
|
677
678
|
thumbnailUrl: imageUrl(publisherConfig, story["hero-image-s3-key"], imageWidth, imageHeight),
|
|
678
679
|
articleBody: storyKeysPresence && getCompleteText(story, structuredData.stripHtmlFromArticleBody) || "",
|
|
679
680
|
dateCreated: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
|
|
680
|
-
dateModified: stripMillisecondsFromTime(new Date(story["
|
|
681
|
+
dateModified: stripMillisecondsFromTime(new Date(story["updated-at"]), timezone),
|
|
681
682
|
datePublished: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
|
|
682
683
|
name: storyKeysPresence && story.headline || "",
|
|
683
684
|
image: generateArticleHeroImageData(story["hero-image-s3-key"], publisherConfig, story["hero-image-metadata"])
|
|
684
|
-
}, isAccessibleForFree, sponsor, { isPartOf: generateIsPartOfDataForArticle(story, publisherConfig) }, articleSectionObj(story));
|
|
685
|
+
}, inLanguage && { inLanguage }, isAccessibleForFree, sponsor, { isPartOf: generateIsPartOfDataForArticle(story, publisherConfig) }, articleSectionObj(story));
|
|
685
686
|
}
|
|
686
687
|
|
|
687
688
|
function generateArticleHeroImageData(image, publisherConfig = {}, imageMetadata = {}) {
|
|
@@ -783,8 +784,7 @@ function generateNewsArticleData(structuredData = {}, story = {}, publisherConfi
|
|
|
783
784
|
const sponsor = metadata.hasOwnProperty("sponsored-by") ? { sponsor: { name: metadata["sponsored-by"] } } : {};
|
|
784
785
|
|
|
785
786
|
return Object.assign({}, {
|
|
786
|
-
alternativeHeadline: alternative.home && alternative.home.default ? alternative.home.default.headline : ""
|
|
787
|
-
description: story.summary
|
|
787
|
+
alternativeHeadline: alternative.home && alternative.home.default ? alternative.home.default.headline : ""
|
|
788
788
|
}, sponsor, isAccessibleForFree, { isPartOf: generateIsPartOfDataForNewsArticle(story, publisherConfig, pageType, structuredData) }, generateHasPartData(storyAccessType));
|
|
789
789
|
}
|
|
790
790
|
|
|
@@ -817,7 +817,7 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
|
|
|
817
817
|
author: authorData(story.authors, authorSchema, publisherConfig),
|
|
818
818
|
coverageEndTime: stripMillisecondsFromTime(new Date(story["last-published-at"]), timezone),
|
|
819
819
|
coverageStartTime: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
|
|
820
|
-
dateModified: stripMillisecondsFromTime(new Date(story["
|
|
820
|
+
dateModified: stripMillisecondsFromTime(new Date(story["updated-at"]), timezone),
|
|
821
821
|
mainEntityOfPage,
|
|
822
822
|
publisher,
|
|
823
823
|
|
package/package.json
CHANGED
|
@@ -33,9 +33,7 @@ export function generateStaticData(config) {
|
|
|
33
33
|
export function generateImageObject(config = {}) {
|
|
34
34
|
const { "theme-attributes": themeConfig = {} } = config;
|
|
35
35
|
return {
|
|
36
|
-
"@context": "http://schema.org",
|
|
37
36
|
"@type": "ImageObject",
|
|
38
|
-
author: config["publisher-name"],
|
|
39
37
|
contentUrl: themeConfig.logo,
|
|
40
38
|
url: themeConfig.logo,
|
|
41
39
|
name: "logo",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { get } from "lodash";
|
|
2
2
|
import { getTitle } from "../generate-common-seo";
|
|
3
3
|
import { stripMillisecondsFromTime } from "../utils";
|
|
4
|
-
export const getSchemaContext = { "@context": "
|
|
4
|
+
export const getSchemaContext = { "@context": "https://schema.org" };
|
|
5
5
|
|
|
6
6
|
export function getSchemaType(type) {
|
|
7
7
|
return { "@type": type };
|
|
@@ -57,7 +57,7 @@ export function getSchemaBlogPosting(
|
|
|
57
57
|
export function getSchemaPublisher(organization, orgUrl) {
|
|
58
58
|
const id = { id: orgUrl };
|
|
59
59
|
return {
|
|
60
|
-
publisher: Object.assign({}, getSchemaType("
|
|
60
|
+
publisher: Object.assign({}, organization, id, getSchemaType("NewsMediaOrganization")),
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./schema";
|
|
18
18
|
|
|
19
19
|
function getLdJsonFields(type, fields) {
|
|
20
|
-
return Object.assign({},
|
|
20
|
+
return Object.assign({}, getSchemaContext, getSchemaType(type), fields);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function ldJson(type, fields) {
|
|
@@ -43,7 +43,7 @@ function generateCommonData(structuredData = {}, story = {}, publisherConfig = {
|
|
|
43
43
|
const storyUrl = story.url || `${publisherConfig["sketches-host"]}/${story.slug}`;
|
|
44
44
|
const orgUrl = get(structuredData, ["organization", "url"], "");
|
|
45
45
|
const mainEntityUrl =
|
|
46
|
-
Object.keys(story).length
|
|
46
|
+
Object.keys(story).length
|
|
47
47
|
? storyUrl
|
|
48
48
|
: get(structuredData, ["organization", "url"], "");
|
|
49
49
|
const imageWidth = 1200;
|
|
@@ -110,21 +110,26 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
|
|
|
110
110
|
const isAccessibleForFree = storyAccessType ? {} : { isAccessibleForFree: storyAccessType };
|
|
111
111
|
const metadata = get(story, ["metadata"], {});
|
|
112
112
|
const sponsor = metadata.hasOwnProperty("sponsored-by") ? { sponsor: { name: metadata["sponsored-by"] } } : {};
|
|
113
|
+
const inLanguage = get(publisherConfig, ["language", "iso-code"], "");
|
|
114
|
+
const description =
|
|
115
|
+
get(story, ["seo", "meta-description"]) || get(story, ["subheadline"]) || get(story, ["headline"]);
|
|
113
116
|
|
|
114
117
|
return Object.assign(
|
|
115
118
|
{},
|
|
116
119
|
generateCommonData(structuredData, story, publisherConfig, timezone),
|
|
117
120
|
{
|
|
121
|
+
description,
|
|
118
122
|
author: authorData(authors, authorSchema, publisherConfig),
|
|
119
123
|
keywords: metaKeywords.join(","),
|
|
120
124
|
thumbnailUrl: imageUrl(publisherConfig, story["hero-image-s3-key"], imageWidth, imageHeight),
|
|
121
125
|
articleBody: (storyKeysPresence && getCompleteText(story, structuredData.stripHtmlFromArticleBody)) || "",
|
|
122
126
|
dateCreated: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
|
|
123
|
-
dateModified: stripMillisecondsFromTime(new Date(story["
|
|
127
|
+
dateModified: stripMillisecondsFromTime(new Date(story["updated-at"]), timezone),
|
|
124
128
|
datePublished: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
|
|
125
129
|
name: (storyKeysPresence && story.headline) || "",
|
|
126
130
|
image: generateArticleHeroImageData(story["hero-image-s3-key"], publisherConfig, story["hero-image-metadata"]),
|
|
127
131
|
},
|
|
132
|
+
inLanguage && { inLanguage },
|
|
128
133
|
isAccessibleForFree,
|
|
129
134
|
sponsor,
|
|
130
135
|
{ isPartOf: generateIsPartOfDataForArticle(story, publisherConfig) },
|
|
@@ -255,7 +260,6 @@ function generateNewsArticleData(structuredData = {}, story = {}, publisherConfi
|
|
|
255
260
|
{},
|
|
256
261
|
{
|
|
257
262
|
alternativeHeadline: alternative.home && alternative.home.default ? alternative.home.default.headline : "",
|
|
258
|
-
description: story.summary,
|
|
259
263
|
},
|
|
260
264
|
sponsor,
|
|
261
265
|
isAccessibleForFree,
|
|
@@ -296,7 +300,7 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
|
|
|
296
300
|
author: authorData(story.authors, authorSchema, publisherConfig),
|
|
297
301
|
coverageEndTime: stripMillisecondsFromTime(new Date(story["last-published-at"]), timezone),
|
|
298
302
|
coverageStartTime: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
|
|
299
|
-
dateModified: stripMillisecondsFromTime(new Date(story["
|
|
303
|
+
dateModified: stripMillisecondsFromTime(new Date(story["updated-at"]), timezone),
|
|
300
304
|
mainEntityOfPage,
|
|
301
305
|
publisher,
|
|
302
306
|
|
|
@@ -117,9 +117,7 @@ describe("Seo Helpers", function () {
|
|
|
117
117
|
name: "abc",
|
|
118
118
|
url: "abc.com",
|
|
119
119
|
logo: {
|
|
120
|
-
"@context": "http://schema.org",
|
|
121
120
|
"@type": "ImageObject",
|
|
122
|
-
author: "abc",
|
|
123
121
|
contentUrl: "https://quintype.com/abc.png?w=300&h=300",
|
|
124
122
|
url: "https://quintype.com/abc.png?w=300&h=300",
|
|
125
123
|
name: "logo",
|
|
@@ -178,9 +176,7 @@ describe("Seo Helpers", function () {
|
|
|
178
176
|
name: "abc",
|
|
179
177
|
url: "abc.com",
|
|
180
178
|
logo: {
|
|
181
|
-
"@context": "http://schema.org",
|
|
182
179
|
"@type": "ImageObject",
|
|
183
|
-
author: "abc",
|
|
184
180
|
contentUrl: "https://quintype.com/abc.png?w=300&h=300",
|
|
185
181
|
url: "https://quintype.com/abc.png?w=300&h=300",
|
|
186
182
|
name: "logo",
|
|
@@ -240,9 +236,7 @@ describe("Seo Helpers", function () {
|
|
|
240
236
|
name: "abc",
|
|
241
237
|
url: "abc.com",
|
|
242
238
|
logo: {
|
|
243
|
-
"@context": "http://schema.org",
|
|
244
239
|
"@type": "ImageObject",
|
|
245
|
-
author: "Abc",
|
|
246
240
|
contentUrl: "https://quintype.com/abc.png",
|
|
247
241
|
url: "https://quintype.com/abc.png",
|
|
248
242
|
name: "logo",
|