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

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,6 @@
3
3
  "editor.defaultFormatter": "esbenp.prettier-vscode"
4
4
  },
5
5
  "editor.tabSize": 2,
6
- "editor.formatOnSave": false,
7
6
  "editor.detectIndentation": false,
8
7
  "files.insertFinalNewline": true,
9
8
  "files.trimTrailingWhitespace": true,
package/dist/index.cjs.js CHANGED
@@ -822,9 +822,21 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
822
822
 
823
823
  function getEmbedUrl(cards) {
824
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) {
825
+
826
+ let storyElemIndex;
827
+
828
+ const card = cards.find(card => {
829
+ const storyElements = card["story-elements"];
830
+ return storyElements.find((elem, index) => {
831
+ if (elem["embed-url"]) {
832
+ storyElemIndex = index;
833
+ return elem["embed-url"];
834
+ }
835
+ return false;
836
+ });
837
+ });
838
+ if (card) {
839
+ const storyElement = card['story-elements'][storyElemIndex];
828
840
  return storyElement["embed-url"];
829
841
  }
830
842
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.6-embed-url.2",
3
+ "version": "1.40.6-embed-url.3",
4
4
  "description": "SEO Modules for Quintype",
5
5
  "main": "dist/index.cjs.js",
6
6
  "repository": "https://github.com/quintype/quintype-node-seo",
@@ -256,12 +256,22 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
256
256
 
257
257
  function getEmbedUrl(cards) {
258
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"];
259
+
260
+ let storyElemIndex;
261
+
262
+ const card = cards.find((card) => {
263
+ const storyElements = card["story-elements"];
264
+ return storyElements.find((elem, index) => {
265
+ if (elem["embed-url"]) {
266
+ storyElemIndex = index;
267
+ return elem["embed-url"];
268
+ }
269
+ return false;
270
+ });
271
+ });
272
+ if (card) {
273
+ const storyElement = card['story-elements'][storyElemIndex]
274
+ return storyElement["embed-url"];
265
275
  }
266
276
  return "";
267
277
  }