@quintype/seo 1.40.7 → 1.40.9-emb-url-fix.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.
@@ -3,8 +3,8 @@
3
3
  "editor.defaultFormatter": "esbenp.prettier-vscode"
4
4
  },
5
5
  "editor.tabSize": 2,
6
- "editor.formatOnSave": true,
7
6
  "editor.detectIndentation": false,
7
+ "editor.formatOnSave": true,
8
8
  "files.insertFinalNewline": true,
9
9
  "files.trimTrailingWhitespace": true,
10
10
  "editor.codeActionsOnSave": {
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
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.40.8](https://github.com/quintype/quintype-node-seo/compare/v1.40.5...v1.40.8) (2022-07-11)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Amphtml error ([#526](https://github.com/quintype/quintype-node-seo/issues/526)) ([24b6c61](https://github.com/quintype/quintype-node-seo/commit/24b6c616118f3db1a2cdda0d98d2827bf2a0d099))
11
+ * **video-structured-data:** use correct embed url ([#528](https://github.com/quintype/quintype-node-seo/issues/528)) ([abe449f](https://github.com/quintype/quintype-node-seo/commit/abe449fd7e75d45f9b9896444f3ef644ca2cf497))
12
+
5
13
  ### [1.40.7](https://github.com/quintype/quintype-node-seo/compare/v1.40.6...v1.40.7) (2022-07-11)
6
14
 
7
15
 
package/dist/index.cjs.js CHANGED
@@ -822,9 +822,30 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
822
822
  };
823
823
  }
824
824
 
825
+ function getEmbedUrl(cards) {
826
+ let embedUrl = "";
827
+
828
+ // not using the return value of top level find
829
+ // coz we only need the embed url
830
+ // find is used for early exit
831
+ cards.find(card => {
832
+ const storyElements = get__default["default"](card, ["story-elements"], []);
833
+ return storyElements.find(elem => {
834
+ if (elem["embed-url"]) {
835
+ embedUrl = elem["embed-url"];
836
+ return true;
837
+ }
838
+ return false;
839
+ });
840
+ });
841
+
842
+ return embedUrl;
843
+ }
844
+
825
845
  function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
826
846
  const metaKeywords = story.seo && story.seo["meta-keywords"] || [];
827
- const embedUrl = get__default["default"](story, ["cards", "0", "story-elements", "0", "embed-url"], "");
847
+ const storyCards = get__default["default"](story, ["cards"], []);
848
+ const embedUrl = getEmbedUrl(storyCards);
828
849
  const socialShareMsg = get__default["default"](story, ["summary"], "");
829
850
  const metaDescription = get__default["default"](story, ["seo", "meta-description"], "");
830
851
  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.7",
3
+ "version": "1.40.9-emb-url-fix.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",
@@ -11,7 +11,7 @@ import {
11
11
  getSchemaPerson,
12
12
  getSchemaPublisher,
13
13
  getSchemaType,
14
- getSchemaWebsite
14
+ getSchemaWebsite,
15
15
  } from "./schema";
16
16
 
17
17
  function getLdJsonFields(type, fields) {
@@ -254,9 +254,30 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
254
254
  };
255
255
  }
256
256
 
257
+ function getEmbedUrl(cards) {
258
+ let embedUrl = "";
259
+
260
+ // not using the return value of top level find
261
+ // coz we only need the embed url
262
+ // find is used for early exit
263
+ cards.find((card) => {
264
+ const storyElements = get(card, ["story-elements"], []);
265
+ return storyElements.find((elem) => {
266
+ if (elem["embed-url"]) {
267
+ embedUrl = elem["embed-url"];
268
+ return true;
269
+ }
270
+ return false;
271
+ });
272
+ });
273
+
274
+ return embedUrl;
275
+ }
276
+
257
277
  function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
258
278
  const metaKeywords = (story.seo && story.seo["meta-keywords"]) || [];
259
- const embedUrl = get(story, ["cards", "0", "story-elements", "0", "embed-url"], "");
279
+ const storyCards = get(story, ["cards"], []);
280
+ const embedUrl = getEmbedUrl(storyCards);
260
281
  const socialShareMsg = get(story, ["summary"], "");
261
282
  const metaDescription = get(story, ["seo", "meta-description"], "");
262
283
  const subHeadline = get(story, ["subheadline"], "");
@@ -476,10 +497,7 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
476
497
  }
477
498
 
478
499
  if (structuredData.enableVideo && story["story-template"] === "video") {
479
- return ldJson(
480
- "VideoObject",
481
- generateVideoArticleData(structuredData, story, publisherConfig, timezone)
482
- );
500
+ return ldJson("VideoObject", generateVideoArticleData(structuredData, story, publisherConfig, timezone));
483
501
  }
484
502
 
485
503
  if (structuredData.enableNewsArticle !== "withoutArticleSchema") {