@quintype/seo 1.46.0 → 1.46.1-support-image-alt-text.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 +4 -3
- package/package.json +1 -1
- package/src/image-tags.js +5 -3
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),
|
|
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 };
|
package/package.json
CHANGED
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),
|
|
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 };
|