@quintype/seo 1.40.5 → 1.40.6-embed-url.2

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.
@@ -3,7 +3,7 @@
3
3
  "editor.defaultFormatter": "esbenp.prettier-vscode"
4
4
  },
5
5
  "editor.tabSize": 2,
6
- "editor.formatOnSave": true,
6
+ "editor.formatOnSave": false,
7
7
  "editor.detectIndentation": false,
8
8
  "files.insertFinalNewline": true,
9
9
  "files.trimTrailingWhitespace": true,
package/dist/index.cjs.js CHANGED
@@ -820,9 +820,20 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
820
820
  };
821
821
  }
822
822
 
823
+ function getEmbedUrl(cards) {
824
+ // get the first story element which has the embed url
825
+ // one more comment
826
+ const storyElement = cards.flatMap(card => card["story-elements"]).find(elem => elem["embed-url"]);
827
+ if (storyElement) {
828
+ return storyElement["embed-url"];
829
+ }
830
+ return "";
831
+ }
832
+
823
833
  function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
824
834
  const metaKeywords = story.seo && story.seo["meta-keywords"] || [];
825
- const embedUrl = get__default["default"](story, ["cards", "0", "story-elements", "0", "embed-url"], "");
835
+ const storyCards = get__default["default"](story, ["cards"], []);
836
+ const embedUrl = getEmbedUrl(storyCards);
826
837
  const socialShareMsg = get__default["default"](story, ["summary"], "");
827
838
  const metaDescription = get__default["default"](story, ["seo", "meta-description"], "");
828
839
  const subHeadline = get__default["default"](story, ["subheadline"], "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.5",
3
+ "version": "1.40.6-embed-url.2",
4
4
  "description": "SEO Modules for Quintype",
5
5
  "main": "dist/index.cjs.js",
6
6
  "repository": "https://github.com/quintype/quintype-node-seo",
@@ -254,9 +254,23 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
254
254
  };
255
255
  }
256
256
 
257
+ function getEmbedUrl(cards) {
258
+ // get the first story element which has the embed url
259
+ // one more comment
260
+ const storyElement = cards
261
+ .flatMap((card) => card["story-elements"])
262
+ .find((elem) => elem["embed-url"]);
263
+ if (storyElement) {
264
+ return storyElement["embed-url"];
265
+ }
266
+ return "";
267
+ }
268
+
269
+
257
270
  function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
258
271
  const metaKeywords = (story.seo && story.seo["meta-keywords"]) || [];
259
- const embedUrl = get(story, ["cards", "0", "story-elements", "0", "embed-url"], "");
272
+ const storyCards = get(story, ["cards"], []);
273
+ const embedUrl = getEmbedUrl(storyCards);
260
274
  const socialShareMsg = get(story, ["summary"], "");
261
275
  const metaDescription = get(story, ["seo", "meta-description"], "");
262
276
  const subHeadline = get(story, ["subheadline"], "");
@@ -476,10 +490,7 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
476
490
  }
477
491
 
478
492
  if (structuredData.enableVideo && story["story-template"] === "video") {
479
- return ldJson(
480
- "VideoObject",
481
- generateVideoArticleData(structuredData, story, publisherConfig, timezone)
482
- );
493
+ return ldJson("VideoObject", generateVideoArticleData(structuredData, story, publisherConfig, timezone));
483
494
  }
484
495
 
485
496
  if (structuredData.enableNewsArticle !== "withoutArticleSchema") {