@quintype/seo 1.46.5 → 1.47.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 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.47.0](https://github.com/quintype/quintype-node-seo/compare/v1.46.5...v1.47.0) (2024-10-30)
6
+
7
+
8
+ ### Features
9
+
10
+ * **sponsor schema:** update article and news article schema for sponsored stories ([#564](https://github.com/quintype/quintype-node-seo/issues/564)) ([ca2cf07](https://github.com/quintype/quintype-node-seo/commit/ca2cf07ed54d6b7508b4d21b1570f45f711b5dc2))
11
+
5
12
  ### [1.46.5](https://github.com/quintype/quintype-node-seo/compare/v1.46.4...v1.46.5) (2024-09-25)
6
13
 
7
14
 
package/dist/index.cjs.js CHANGED
@@ -642,6 +642,9 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
642
642
  const storyAccessType = storyAccess(story["access"]);
643
643
  const authorSchema = structuredData.authorSchema && structuredData.authorSchema(story) || [];
644
644
  const isAccessibleForFree = storyAccessType ? {} : { isAccessibleForFree: storyAccessType };
645
+ const metadata = get__default["default"](story, ["metadata"], {});
646
+ const sponsor = metadata.hasOwnProperty("sponsored-by") ? { sponsor: { name: metadata["sponsored-by"] } } : {};
647
+
645
648
  return Object.assign({}, generateCommonData(structuredData, story, publisherConfig, timezone), {
646
649
  author: authorData(authors, authorSchema, publisherConfig),
647
650
  keywords: metaKeywords.join(","),
@@ -652,7 +655,7 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
652
655
  datePublished: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
653
656
  name: storyKeysPresence && story.headline || "",
654
657
  image: generateArticleImageData(story["hero-image-s3-key"], publisherConfig)
655
- }, isAccessibleForFree, { isPartOf: generateIsPartOfDataForArticle(story, publisherConfig) }, articleSectionObj(story));
658
+ }, isAccessibleForFree, sponsor, { isPartOf: generateIsPartOfDataForArticle(story, publisherConfig) }, articleSectionObj(story));
656
659
  }
657
660
 
658
661
  function generateArticleImageData(image, publisherConfig = {}) {
@@ -722,10 +725,13 @@ function generateNewsArticleData(structuredData = {}, story = {}, publisherConfi
722
725
  const { alternative = {} } = story.alternative || {};
723
726
  const storyAccessType = storyAccess(story["access"]);
724
727
  const isAccessibleForFree = storyAccessType ? {} : { isAccessibleForFree: storyAccessType };
728
+ const metadata = get__default["default"](story, ["metadata"], {});
729
+ const sponsor = metadata.hasOwnProperty("sponsored-by") ? { sponsor: { name: metadata["sponsored-by"] } } : {};
730
+
725
731
  return Object.assign({}, {
726
732
  alternativeHeadline: alternative.home && alternative.home.default ? alternative.home.default.headline : "",
727
733
  description: story.summary
728
- }, isAccessibleForFree, { isPartOf: generateIsPartOfDataForNewsArticle(story, publisherConfig, pageType, structuredData) }, generateHasPartData(storyAccessType));
734
+ }, sponsor, isAccessibleForFree, { isPartOf: generateIsPartOfDataForNewsArticle(story, publisherConfig, pageType, structuredData) }, generateHasPartData(storyAccessType));
729
735
  }
730
736
 
731
737
  function findStoryElementField(card, type, field, defaultValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.46.5",
3
+ "version": "1.47.0",
4
4
  "description": "SEO Modules for Quintype",
5
5
  "main": "dist/index.cjs.js",
6
6
  "repository": "https://github.com/quintype/quintype-node-seo",
@@ -107,6 +107,9 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
107
107
  const storyAccessType = storyAccess(story["access"]);
108
108
  const authorSchema = (structuredData.authorSchema && structuredData.authorSchema(story)) || [];
109
109
  const isAccessibleForFree = storyAccessType ? {} : { isAccessibleForFree: storyAccessType };
110
+ const metadata = get(story, ["metadata"], {});
111
+ const sponsor = metadata.hasOwnProperty("sponsored-by") ? { sponsor: { name: metadata["sponsored-by"] } } : {};
112
+
110
113
  return Object.assign(
111
114
  {},
112
115
  generateCommonData(structuredData, story, publisherConfig, timezone),
@@ -122,6 +125,7 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
122
125
  image: generateArticleImageData(story["hero-image-s3-key"], publisherConfig),
123
126
  },
124
127
  isAccessibleForFree,
128
+ sponsor,
125
129
  { isPartOf: generateIsPartOfDataForArticle(story, publisherConfig) },
126
130
  articleSectionObj(story)
127
131
  );
@@ -210,12 +214,16 @@ function generateNewsArticleData(structuredData = {}, story = {}, publisherConfi
210
214
  const { alternative = {} } = story.alternative || {};
211
215
  const storyAccessType = storyAccess(story["access"]);
212
216
  const isAccessibleForFree = storyAccessType ? {} : { isAccessibleForFree: storyAccessType };
217
+ const metadata = get(story, ["metadata"], {});
218
+ const sponsor = metadata.hasOwnProperty("sponsored-by") ? { sponsor: { name: metadata["sponsored-by"] } } : {};
219
+
213
220
  return Object.assign(
214
221
  {},
215
222
  {
216
223
  alternativeHeadline: alternative.home && alternative.home.default ? alternative.home.default.headline : "",
217
224
  description: story.summary,
218
225
  },
226
+ sponsor,
219
227
  isAccessibleForFree,
220
228
  { isPartOf: generateIsPartOfDataForNewsArticle(story, publisherConfig, pageType, structuredData) },
221
229
  generateHasPartData(storyAccessType)