@quintype/seo 1.40.6-embed-url.0 → 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.
package/.vscode/settings.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -820,23 +820,32 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
|
|
|
820
820
|
};
|
|
821
821
|
}
|
|
822
822
|
|
|
823
|
-
function getEmbedUrl(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
823
|
+
function getEmbedUrl(cards) {
|
|
824
|
+
// get the first story element which has the embed url
|
|
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"];
|
|
830
834
|
}
|
|
831
|
-
|
|
835
|
+
return false;
|
|
836
|
+
});
|
|
837
|
+
});
|
|
838
|
+
if (card) {
|
|
839
|
+
const storyElement = card['story-elements'][storyElemIndex];
|
|
840
|
+
return storyElement["embed-url"];
|
|
832
841
|
}
|
|
833
|
-
|
|
834
|
-
return '';
|
|
842
|
+
return "";
|
|
835
843
|
}
|
|
836
844
|
|
|
837
845
|
function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
|
|
838
846
|
const metaKeywords = story.seo && story.seo["meta-keywords"] || [];
|
|
839
|
-
const
|
|
847
|
+
const storyCards = get__default["default"](story, ["cards"], []);
|
|
848
|
+
const embedUrl = getEmbedUrl(storyCards);
|
|
840
849
|
const socialShareMsg = get__default["default"](story, ["summary"], "");
|
|
841
850
|
const metaDescription = get__default["default"](story, ["seo", "meta-description"], "");
|
|
842
851
|
const subHeadline = get__default["default"](story, ["subheadline"], "");
|
package/package.json
CHANGED
|
@@ -254,24 +254,33 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
|
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
function getEmbedUrl(
|
|
258
|
-
|
|
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
|
-
}
|
|
257
|
+
function getEmbedUrl(cards) {
|
|
258
|
+
// get the first story element which has the embed url
|
|
266
259
|
|
|
267
|
-
|
|
260
|
+
let storyElemIndex;
|
|
268
261
|
|
|
269
|
-
|
|
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"];
|
|
275
|
+
}
|
|
276
|
+
return "";
|
|
270
277
|
}
|
|
271
278
|
|
|
279
|
+
|
|
272
280
|
function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
|
|
273
281
|
const metaKeywords = (story.seo && story.seo["meta-keywords"]) || [];
|
|
274
|
-
const
|
|
282
|
+
const storyCards = get(story, ["cards"], []);
|
|
283
|
+
const embedUrl = getEmbedUrl(storyCards);
|
|
275
284
|
const socialShareMsg = get(story, ["summary"], "");
|
|
276
285
|
const metaDescription = get(story, ["seo", "meta-description"], "");
|
|
277
286
|
const subHeadline = get(story, ["subheadline"], "");
|
|
@@ -491,10 +500,7 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
|
|
|
491
500
|
}
|
|
492
501
|
|
|
493
502
|
if (structuredData.enableVideo && story["story-template"] === "video") {
|
|
494
|
-
return ldJson(
|
|
495
|
-
"VideoObject",
|
|
496
|
-
generateVideoArticleData(structuredData, story, publisherConfig, timezone)
|
|
497
|
-
);
|
|
503
|
+
return ldJson("VideoObject", generateVideoArticleData(structuredData, story, publisherConfig, timezone));
|
|
498
504
|
}
|
|
499
505
|
|
|
500
506
|
if (structuredData.enableNewsArticle !== "withoutArticleSchema") {
|