@quintype/seo 1.40.5 → 1.40.6-embed-url.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
@@ -820,9 +820,23 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
820
820
  };
821
821
  }
822
822
 
823
+ function getEmbedUrl({ cards }) {
824
+ for (let i = 0; i < cards.length; i++) {
825
+ const storyElements = cards[i]["story-elements"];
826
+ for (let j = 0; j < storyElements.length; j++) {
827
+ const storyElement = storyElements[j];
828
+ if (storyElement["embed-url"]) {
829
+ return storyElement["embed-url"];
830
+ }
831
+ }
832
+ }
833
+
834
+ return '';
835
+ }
836
+
823
837
  function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
824
838
  const metaKeywords = story.seo && story.seo["meta-keywords"] || [];
825
- const embedUrl = get__default["default"](story, ["cards", "0", "story-elements", "0", "embed-url"], "");
839
+ const embedUrl = getEmbedUrl(story);
826
840
  const socialShareMsg = get__default["default"](story, ["summary"], "");
827
841
  const metaDescription = get__default["default"](story, ["seo", "meta-description"], "");
828
842
  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.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",
@@ -254,9 +254,24 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
254
254
  };
255
255
  }
256
256
 
257
+ function getEmbedUrl({cards}) {
258
+ for (let i = 0; i < cards.length; i++) {
259
+ const storyElements = cards[i]["story-elements"];
260
+ for (let j = 0; j < storyElements.length; j++) {
261
+ const storyElement = storyElements[j];
262
+ if (storyElement["embed-url"]) {
263
+ return storyElement["embed-url"]
264
+ }
265
+ }
266
+
267
+ }
268
+
269
+ return ''
270
+ }
271
+
257
272
  function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
258
273
  const metaKeywords = (story.seo && story.seo["meta-keywords"]) || [];
259
- const embedUrl = get(story, ["cards", "0", "story-elements", "0", "embed-url"], "");
274
+ const embedUrl = getEmbedUrl(story)
260
275
  const socialShareMsg = get(story, ["summary"], "");
261
276
  const metaDescription = get(story, ["seo", "meta-description"], "");
262
277
  const subHeadline = get(story, ["subheadline"], "");