@quintype/seo 1.46.3 → 1.46.4-recipe-schema.1
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
CHANGED
|
@@ -553,6 +553,45 @@ function generateAuthorPageSchema(publisherConfig, data, url) {
|
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
+
function generateRecipePageSchema(publisherConfig, data, url, story) {
|
|
557
|
+
publisherConfig["sketches-host"];
|
|
558
|
+
getTitle$1(publisherConfig);
|
|
559
|
+
url["href"];
|
|
560
|
+
lodash.get(data, ["author", "name"], "");
|
|
561
|
+
// console.log("generateRecipePageSchema --->", { publisherConfig, data, url, story });
|
|
562
|
+
return {
|
|
563
|
+
"@context": "https://schema.org/",
|
|
564
|
+
"@type": "Recipe",
|
|
565
|
+
name: story.headline,
|
|
566
|
+
url: story.url,
|
|
567
|
+
author: {
|
|
568
|
+
"@type": "Person",
|
|
569
|
+
name: story["author-name"]
|
|
570
|
+
},
|
|
571
|
+
image: { "@type": "ImageObject", url: story.url },
|
|
572
|
+
description: story.description,
|
|
573
|
+
recipeIngredient: ["1 cup sugar", "2 cups flour", "1 cup chocolate chips"],
|
|
574
|
+
recipeInstructions: [{
|
|
575
|
+
"@type": "HowToStep",
|
|
576
|
+
text: "Preheat the oven to 350 degrees F."
|
|
577
|
+
}, {
|
|
578
|
+
"@type": "HowToStep",
|
|
579
|
+
text: "Mix the sugar and flour."
|
|
580
|
+
}, {
|
|
581
|
+
"@type": "HowToStep",
|
|
582
|
+
text: "Add the chocolate chips and bake for 10 minutes."
|
|
583
|
+
}],
|
|
584
|
+
recipeYield: "24 cookies",
|
|
585
|
+
prepTime: "PT20M",
|
|
586
|
+
cookTime: "PT10M",
|
|
587
|
+
totalTime: "PT30M",
|
|
588
|
+
nutrition: {
|
|
589
|
+
"@type": "NutritionInformation",
|
|
590
|
+
calories: "200 calories"
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
556
595
|
function getMovieEntityTags(movieJson) {
|
|
557
596
|
return getSchemaMovieReview(movieJson);
|
|
558
597
|
}
|
|
@@ -757,9 +796,9 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
|
|
|
757
796
|
function getEmbedUrl(cards) {
|
|
758
797
|
const playerUrlMapping = {
|
|
759
798
|
"dailymotion-embed-script": "dailymotion-url",
|
|
760
|
-
|
|
799
|
+
instagram: "instagram-url",
|
|
761
800
|
"facebook-video": "facebook-url",
|
|
762
|
-
|
|
801
|
+
tweet: "tweet-url",
|
|
763
802
|
"vimeo-video": "vimeo-url",
|
|
764
803
|
"brightcove-video": "player-url"
|
|
765
804
|
};
|
|
@@ -772,7 +811,8 @@ function getEmbedUrl(cards) {
|
|
|
772
811
|
if (elem.metadata && elem.metadata[playerUrlField]) {
|
|
773
812
|
return elem.metadata[playerUrlField];
|
|
774
813
|
}
|
|
775
|
-
}
|
|
814
|
+
}
|
|
815
|
+
if (elem.type === "youtube-video" && elem.subtype === null) {
|
|
776
816
|
if (elem.url) {
|
|
777
817
|
return elem.url;
|
|
778
818
|
}
|
|
@@ -937,7 +977,6 @@ function StructuredDataTags({ structuredData = {} }, config, pageType, response
|
|
|
937
977
|
const isStructuredDataEmpty = Object.keys(structuredData).length === 0;
|
|
938
978
|
const enableBreadcrumbList = get__default["default"](structuredData, ["enableBreadcrumbList"], true);
|
|
939
979
|
const structuredDataTags = get__default["default"](structuredData, ["structuredDataTags"], []);
|
|
940
|
-
|
|
941
980
|
let articleData = {};
|
|
942
981
|
|
|
943
982
|
if (!isStructuredDataEmpty) {
|
|
@@ -966,6 +1005,10 @@ function StructuredDataTags({ structuredData = {} }, config, pageType, response
|
|
|
966
1005
|
if (!isStructuredDataEmpty && pageType === "story-page") {
|
|
967
1006
|
const newsArticleTags = generateNewsArticleTags();
|
|
968
1007
|
newsArticleTags ? tags.push(storyTags(), newsArticleTags) : tags.push(storyTags());
|
|
1008
|
+
if (story["story-template"] === "recipe") {
|
|
1009
|
+
const recipeTags = generateRecipePageSchema(publisherConfig, response.data, url, story);
|
|
1010
|
+
tags.push(recipeTags);
|
|
1011
|
+
}
|
|
969
1012
|
}
|
|
970
1013
|
|
|
971
1014
|
if (!isStructuredDataEmpty && pageType === "story-page-amp") {
|
package/package.json
CHANGED
|
@@ -151,3 +151,47 @@ export function generateAuthorPageSchema(publisherConfig, data, url) {
|
|
|
151
151
|
},
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
export function generateRecipePageSchema(publisherConfig, data, url, story) {
|
|
156
|
+
const sketchesHost = publisherConfig["sketches-host"];
|
|
157
|
+
const publisherName = getTitle(publisherConfig);
|
|
158
|
+
const authorHREF = url["href"];
|
|
159
|
+
const authorURL = `${sketchesHost}${authorHREF}`;
|
|
160
|
+
const authorName = get(data, ["author", "name"], "");
|
|
161
|
+
// console.log("generateRecipePageSchema --->", { publisherConfig, data, url, story });
|
|
162
|
+
return {
|
|
163
|
+
"@context": "https://schema.org/",
|
|
164
|
+
"@type": "Recipe",
|
|
165
|
+
name: story.headline,
|
|
166
|
+
url: story.url,
|
|
167
|
+
author: {
|
|
168
|
+
"@type": "Person",
|
|
169
|
+
name: story["author-name"],
|
|
170
|
+
},
|
|
171
|
+
image: { "@type": "ImageObject", url: story.url },
|
|
172
|
+
description: story.description,
|
|
173
|
+
recipeIngredient: ["1 cup sugar", "2 cups flour", "1 cup chocolate chips"],
|
|
174
|
+
recipeInstructions: [
|
|
175
|
+
{
|
|
176
|
+
"@type": "HowToStep",
|
|
177
|
+
text: "Preheat the oven to 350 degrees F.",
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"@type": "HowToStep",
|
|
181
|
+
text: "Mix the sugar and flour.",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"@type": "HowToStep",
|
|
185
|
+
text: "Add the chocolate chips and bake for 10 minutes.",
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
recipeYield: "24 cookies",
|
|
189
|
+
prepTime: "PT20M",
|
|
190
|
+
cookTime: "PT10M",
|
|
191
|
+
totalTime: "PT30M",
|
|
192
|
+
nutrition: {
|
|
193
|
+
"@type": "NutritionInformation",
|
|
194
|
+
calories: "200 calories",
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
@@ -3,6 +3,7 @@ import { getQueryParams, stripMillisecondsFromTime } from "../utils";
|
|
|
3
3
|
import { generateTagsForEntity } from "./entity";
|
|
4
4
|
import {
|
|
5
5
|
generateAuthorPageSchema,
|
|
6
|
+
generateRecipePageSchema,
|
|
6
7
|
getSchemaBlogPosting,
|
|
7
8
|
getSchemaBreadcrumbList,
|
|
8
9
|
getSchemaContext,
|
|
@@ -265,11 +266,11 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
|
|
|
265
266
|
function getEmbedUrl(cards) {
|
|
266
267
|
const playerUrlMapping = {
|
|
267
268
|
"dailymotion-embed-script": "dailymotion-url",
|
|
268
|
-
|
|
269
|
+
instagram: "instagram-url",
|
|
269
270
|
"facebook-video": "facebook-url",
|
|
270
|
-
|
|
271
|
+
tweet: "tweet-url",
|
|
271
272
|
"vimeo-video": "vimeo-url",
|
|
272
|
-
"brightcove-video": "player-url"
|
|
273
|
+
"brightcove-video": "player-url",
|
|
273
274
|
};
|
|
274
275
|
|
|
275
276
|
for (const card of cards) {
|
|
@@ -280,7 +281,7 @@ function getEmbedUrl(cards) {
|
|
|
280
281
|
if (elem.metadata && elem.metadata[playerUrlField]) {
|
|
281
282
|
return elem.metadata[playerUrlField];
|
|
282
283
|
}
|
|
283
|
-
}
|
|
284
|
+
}
|
|
284
285
|
if (elem.type === "youtube-video" && elem.subtype === null) {
|
|
285
286
|
if (elem.url) {
|
|
286
287
|
return elem.url;
|
|
@@ -446,7 +447,6 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
|
|
|
446
447
|
const isStructuredDataEmpty = Object.keys(structuredData).length === 0;
|
|
447
448
|
const enableBreadcrumbList = get(structuredData, ["enableBreadcrumbList"], true);
|
|
448
449
|
const structuredDataTags = get(structuredData, ["structuredDataTags"], []);
|
|
449
|
-
|
|
450
450
|
let articleData = {};
|
|
451
451
|
|
|
452
452
|
if (!isStructuredDataEmpty) {
|
|
@@ -475,6 +475,10 @@ export function StructuredDataTags({ structuredData = {} }, config, pageType, re
|
|
|
475
475
|
if (!isStructuredDataEmpty && pageType === "story-page") {
|
|
476
476
|
const newsArticleTags = generateNewsArticleTags();
|
|
477
477
|
newsArticleTags ? tags.push(storyTags(), newsArticleTags) : tags.push(storyTags());
|
|
478
|
+
if (story["story-template"] === "recipe") {
|
|
479
|
+
const recipeTags = generateRecipePageSchema(publisherConfig, response.data, url, story);
|
|
480
|
+
tags.push(recipeTags);
|
|
481
|
+
}
|
|
478
482
|
}
|
|
479
483
|
|
|
480
484
|
if (!isStructuredDataEmpty && pageType === "story-page-amp") {
|