@quintype/seo 1.46.1 → 1.46.3-fix-video-schema.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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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.46.2](https://github.com/quintype/quintype-node-seo/compare/v1.46.1...v1.46.2) (2024-06-12)
6
+
5
7
  ### [1.46.1](https://github.com/quintype/quintype-node-seo/compare/v1.46.0...v1.46.1) (2024-06-11)
6
8
 
7
9
  ## [1.46.0](https://github.com/quintype/quintype-node-seo/compare/v1.44.1...v1.46.0) (2024-04-18)
package/dist/index.cjs.js CHANGED
@@ -239,7 +239,7 @@ function getSiteTwitterHandle(config, fallback) {
239
239
  function pickImageFromCard(story, cardId) {
240
240
  const { metadata = {} } = story.cards.find(card => card.id === cardId) || {};
241
241
  if (metadata && !lodash.isEmpty(metadata) && lodash.get(metadata, ["social-share", "image", "key"], false)) {
242
- const alt = metadata["social-share"].image.attribution || metadata["social-share"].title || metadata["social-share"].message || getAttribution(story);
242
+ const alt = metadata["social-share"].image["alt-text"] || metadata["social-share"].image.attribution || metadata["social-share"].title || metadata["social-share"].message || getAttribution(story);
243
243
  return {
244
244
  image: new quintypeJs.FocusedImage(metadata["social-share"].image.key, metadata["social-share"].image.metadata || {}),
245
245
  alt
@@ -248,7 +248,7 @@ function pickImageFromCard(story, cardId) {
248
248
  }
249
249
 
250
250
  function getAttribution(story) {
251
- return story["hero-image-attribution"] || story.summary || lodash.get(story, ["alternative", "home", "default", "headline"]) || story.headline;
251
+ return story["hero-image-alt-text"] || story["hero-image-attribution"] || story.summary || lodash.get(story, ["alternative", "home", "default", "hero-image", "hero-image-alt-text"]) || lodash.get(story, ["alternative", "home", "default", "headline"]) || story.headline;
252
252
  }
253
253
 
254
254
  /**
@@ -270,13 +270,14 @@ function pickImageFromStory({ story, config, seoConfig }) {
270
270
  const fallbackSocialImage = lodash.get(seoConfig, ["fallbackSocialImage"]);
271
271
  const altHeroImg = getAlt("home", "hero-image-s3-key", null);
272
272
  const altSocialHeroImg = getAlt("social", "hero-image-s3-key", null);
273
+ const altSocialAltText = getAlt("social", "hero-image-alt-text", getAttribution(story));
273
274
  const storyHeroImage = lodash.get(story, ["hero-image-s3-key"]);
274
275
  const logo_url = lodash.get(config, ["theme-attributes", "logo_url"]);
275
276
  const logo = lodash.get(config, ["theme-attributes", "logo"]);
276
277
 
277
278
  if (altSocialHeroImg) {
278
279
  const metadata = getAlt("social", "hero-image-metadata", {});
279
- return { image: new quintypeJs.FocusedImage(altSocialHeroImg, metadata), alt };
280
+ return { image: new quintypeJs.FocusedImage(altSocialHeroImg, metadata), altSocialAltText };
280
281
  } else if (altHeroImg) {
281
282
  const metadata = getAlt("home", "hero-image-metadata", {});
282
283
  return { image: new quintypeJs.FocusedImage(altHeroImg, metadata), alt };
@@ -756,15 +757,20 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
756
757
  function getEmbedUrl(cards) {
757
758
  let embedUrl = "";
758
759
 
759
- // not using the return value of top level find
760
- // coz we only need the embed url
761
- // find is used for early exit
762
- cards.find(card => {
760
+ const urlKeys = ["embed-url", "instagram-url", "dailymotion-url", "facebook-url", "tweet-url", "vimeo-url", "player-url"];
761
+
762
+ cards.some(card => {
763
763
  const storyElements = get__default["default"](card, ["story-elements"], []);
764
- return storyElements.find(elem => {
765
- if (elem["embed-url"]) {
766
- embedUrl = elem["embed-url"];
767
- return true;
764
+ return storyElements.some(elem => {
765
+ for (let key of urlKeys) {
766
+ if (elem[key]) {
767
+ embedUrl = elem[key];
768
+ return true;
769
+ }
770
+ if (elem.metadata && elem.metadata[key]) {
771
+ embedUrl = elem.metadata[key];
772
+ return true;
773
+ }
768
774
  }
769
775
  return false;
770
776
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.46.1",
3
+ "version": "1.46.3-fix-video-schema.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",
package/src/image-tags.js CHANGED
@@ -6,6 +6,7 @@ function pickImageFromCard(story, cardId) {
6
6
  const { metadata = {} } = story.cards.find((card) => card.id === cardId) || {};
7
7
  if (metadata && !isEmpty(metadata) && get(metadata, ["social-share", "image", "key"], false)) {
8
8
  const alt =
9
+ metadata["social-share"].image["alt-text"] ||
9
10
  metadata["social-share"].image.attribution ||
10
11
  metadata["social-share"].title ||
11
12
  metadata["social-share"].message ||
@@ -19,8 +20,8 @@ function pickImageFromCard(story, cardId) {
19
20
 
20
21
  function getAttribution(story) {
21
22
  return (
22
- story["hero-image-attribution"] ||
23
- story.summary ||
23
+ story["hero-image-alt-text"] || story["hero-image-attribution"] ||
24
+ story.summary || get(story, ["alternative", "home", "default", "hero-image", "hero-image-alt-text"]) ||
24
25
  get(story, ["alternative", "home", "default", "headline"]) ||
25
26
  story.headline
26
27
  );
@@ -45,13 +46,14 @@ function pickImageFromStory({ story, config, seoConfig }) {
45
46
  const fallbackSocialImage = get(seoConfig, ["fallbackSocialImage"]);
46
47
  const altHeroImg = getAlt("home", "hero-image-s3-key", null);
47
48
  const altSocialHeroImg = getAlt("social", "hero-image-s3-key", null);
49
+ const altSocialAltText = getAlt("social", "hero-image-alt-text", getAttribution(story));
48
50
  const storyHeroImage = get(story, ["hero-image-s3-key"]);
49
51
  const logo_url = get(config, ["theme-attributes", "logo_url"]);
50
52
  const logo = get(config, ["theme-attributes", "logo"]);
51
53
 
52
54
  if (altSocialHeroImg) {
53
55
  const metadata = getAlt("social", "hero-image-metadata", {});
54
- return { image: new FocusedImage(altSocialHeroImg, metadata), alt };
56
+ return { image: new FocusedImage(altSocialHeroImg, metadata), altSocialAltText };
55
57
  } else if (altHeroImg) {
56
58
  const metadata = getAlt("home", "hero-image-metadata", {});
57
59
  return { image: new FocusedImage(altHeroImg, metadata), alt };
@@ -265,15 +265,28 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
265
265
  function getEmbedUrl(cards) {
266
266
  let embedUrl = "";
267
267
 
268
- // not using the return value of top level find
269
- // coz we only need the embed url
270
- // find is used for early exit
271
- cards.find((card) => {
268
+ const urlKeys = [
269
+ "embed-url",
270
+ "instagram-url",
271
+ "dailymotion-url",
272
+ "facebook-url",
273
+ "tweet-url",
274
+ "vimeo-url",
275
+ "player-url"
276
+ ];
277
+
278
+ cards.some(card => {
272
279
  const storyElements = get(card, ["story-elements"], []);
273
- return storyElements.find((elem) => {
274
- if (elem["embed-url"]) {
275
- embedUrl = elem["embed-url"];
276
- return true;
280
+ return storyElements.some(elem => {
281
+ for (let key of urlKeys) {
282
+ if (elem[key]) {
283
+ embedUrl = elem[key];
284
+ return true;
285
+ }
286
+ if (elem.metadata && elem.metadata[key]) {
287
+ embedUrl = elem.metadata[key];
288
+ return true;
289
+ }
277
290
  }
278
291
  return false;
279
292
  });