@quintype/seo 1.46.3 → 1.46.4-fix-pb-3258.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/dist/index.cjs.js CHANGED
@@ -736,12 +736,20 @@ function findStoryElementField(card, type, field, defaultValue) {
736
736
  if (elements.length > 0) return elements[0][field];else return defaultValue;
737
737
  }
738
738
 
739
+ function getTextElementsOfOneCard(storyElements = []) {
740
+ return storyElements.filter(element => element.type === "text");
741
+ }
742
+
743
+ function getCompleteTextOfOneCard(storyElements, stripHtmlFromArticleBody) {
744
+ return getTextElementsOfOneCard(storyElements).map(item => stripHtmlFromArticleBody ? getPlainText(item.text) : item.text).join(".");
745
+ }
746
+
739
747
  function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
740
748
  const imageWidth = 1200;
741
749
  const imageHeight = 675;
742
750
  const authorSchema = structuredData.authorSchema && structuredData.authorSchema(story) || [];
743
751
  const storyKeysPresence = Object.keys(story).length > 0;
744
- const articleBody = storyKeysPresence && getCompleteText(story, structuredData.stripHtmlFromArticleBody) || "";
752
+ storyKeysPresence && getCompleteText(story, structuredData.stripHtmlFromArticleBody) || "";
745
753
  return {
746
754
  headline: story.headline,
747
755
  description: story.summary || story.headline,
@@ -750,7 +758,12 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
750
758
  coverageStartTime: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
751
759
  dateModified: stripMillisecondsFromTime(new Date(story["last-published-at"]), timezone),
752
760
 
753
- liveBlogUpdate: story.cards.map(card => getSchemaBlogPosting(card, authorData(story.authors, authorSchema, publisherConfig), findStoryElementField(card, "title", "text", story.headline), imageUrl(publisherConfig, findStoryElementField(card, "image", "image-s3-key", story["hero-image-s3-key"]), imageWidth, imageHeight), structuredData, story, timezone, articleBody))
761
+ liveBlogUpdate: story.cards.map(card => {
762
+ const storyElements = get__default["default"](card, ["story-elements"]);
763
+ const cardArticleBody = getCompleteTextOfOneCard(storyElements, structuredData.stripHtmlFromArticleBody) || "";
764
+
765
+ return getSchemaBlogPosting(card, authorData(story.authors, authorSchema, publisherConfig), findStoryElementField(card, "title", "text", story.headline), imageUrl(publisherConfig, findStoryElementField(card, "image", "image-s3-key", story["hero-image-s3-key"]), imageWidth, imageHeight), structuredData, story, timezone, cardArticleBody);
766
+ })
754
767
  };
755
768
  }
756
769
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.46.3",
3
+ "version": "1.46.4-fix-pb-3258.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",
@@ -228,6 +228,16 @@ function findStoryElementField(card, type, field, defaultValue) {
228
228
  else return defaultValue;
229
229
  }
230
230
 
231
+ function getTextElementsOfOneCard(storyElements = []) {
232
+ return storyElements.filter((element) => element.type === "text");
233
+ }
234
+
235
+ function getCompleteTextOfOneCard(storyElements, stripHtmlFromArticleBody) {
236
+ return getTextElementsOfOneCard(storyElements)
237
+ .map((item) => (stripHtmlFromArticleBody ? getPlainText(item.text) : item.text))
238
+ .join(".");
239
+ }
240
+
231
241
  function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
232
242
  const imageWidth = 1200;
233
243
  const imageHeight = 675;
@@ -242,8 +252,11 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
242
252
  coverageStartTime: stripMillisecondsFromTime(new Date(story["first-published-at"]), timezone),
243
253
  dateModified: stripMillisecondsFromTime(new Date(story["last-published-at"]), timezone),
244
254
 
245
- liveBlogUpdate: story.cards.map((card) =>
246
- getSchemaBlogPosting(
255
+ liveBlogUpdate: story.cards.map((card) => {
256
+ const storyElements = get(card, ["story-elements"]);
257
+ const cardArticleBody = getCompleteTextOfOneCard(storyElements, structuredData.stripHtmlFromArticleBody) || "";
258
+
259
+ return getSchemaBlogPosting(
247
260
  card,
248
261
  authorData(story.authors, authorSchema, publisherConfig),
249
262
  findStoryElementField(card, "title", "text", story.headline),
@@ -256,9 +269,9 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
256
269
  structuredData,
257
270
  story,
258
271
  timezone,
259
- articleBody
260
- )
261
- ),
272
+ cardArticleBody
273
+ );
274
+ }),
262
275
  };
263
276
  }
264
277