title: "Recipe" post_status: publish comment_status: open taxonomy: category: - yoast-developer post_tag: - Pieces - Schema - Features


import YoastSchemaExample from '../../../../src/components/YoastSchemaExample';

描述一个 Recipe(菜谱),它包含一系列步骤说明、食材和可选字段。

触发条件

当页面内容描述一个菜谱时,应将其作为图谱中的顶级节点添加。

必需属性

一个有效的 Recipe 必须包含以下属性。

故障场景

如果 Recipe 的任何必填字段缺失或无效,则不应输出该节点。

如果某个节点未被输出,则任何原本会声明与其存在关系的实体都应移除这些引用。

可选属性

以下属性在可用且有效时应添加:

条件属性

当菜谱是页面的“主要实体”时

当仅指定 cookTimeprepTime 之一时

当同时指定 cookTimeprepTime

当页面包含有效的 Article

ArticleAuthor

Examples

Minimum criteria

{{ "@context": "https://schema.org", "@graph": [ { "@type": "Recipe", "mainEntityOfPage": { "@id": "https://www.example.com/#/schema/Article/abc123" }, "name": "Party Coffee Cake", "image": { "@id": "https://www.example.com/uploads/example-image.jpg" }, "recipeIngredient": [ "2 cups of flour", "3/4 cup white sugar", "2 teaspoons baking powder", "1/2 teaspoon salt", "1/2 cup butter", "2 eggs", "3/4 cup milk" ], "recipeInstructions": [ { "@type": "HowToStep", "text": "Preheat the oven to 350 degrees F. Grease and flour a 9x9 inch pan.", "url": "https://example.com/example-page/#recipe-step-1" }, { "@type": "HowToStep", "text": "In a large bowl, combine flour, sugar, baking powder, and salt.", "url": "https://example.com/example-page/#recipe-step-2" }, { "@type": "HowToStep", "text": "Mix in the butter, eggs, and milk.", "url": "https://example.com/example-page/#recipe-step-3" }, { "@type": "HowToStep", "text": "Spread into the prepared pan.", "url": "https://example.com/example-page/#recipe-step-4" }, { "@type": "HowToStep", "name": "Bake", "url": "https://example.com/example-page/#recipe-step-5" }, { "@type": "HowToStep", "text": "Allow to cool and enjoy.", "url": "https://example.com/example-page/#recipe-step-6" } ] } ] }}

扩展标准

{{ "@context": "https://schema.org", "@graph": [ { "@type": "Recipe", "mainEntityOfPage": { "@id": "https://www.example.com/#/schema/Article/abc123" }, "name": "Party Coffee Cake", "image": { "@id": "https://www.example.com/uploads/example-image.jpg" }, "video": { "@id": "https://www.example.com/#/schema/VideoObject/abc123" }, "author": { "@id": "https://www.example.com/#/schema/Person/abc123" }, "inLanguage": "en-GB", "datePublished": "2018-03-10", "description": "This coffee cake is awesome and perfect for parties.", "prepTime": "PT20M", "cookTime": "PT30M", "totalTime": "PT50M", "keywords": "cake for a party, coffee", "recipeYield": "10", "recipeCategory": "Dessert", "recipeCuisine": "American", "suitableForDiet": [ "VegetarianDiet", "LowSaltDiet" ], "tools": [ "A 9x9 inch pan", "A large mixing bowl" ], "nutrition": { "@type": "NutritionInformation", "calories": "270 calories" }, "recipeIngredient": [ "2 cups of flour", "3/4 cup white sugar", "2 teaspoons baking powder", "1/2 teaspoon salt", "1/2 cup butter", "2 eggs", "3/4 cup milk" ], "recipeInstructions": [ { "@type": "HowToStep", "name": "Preheat", "text": "Preheat the oven to 350 degrees F. Grease and flour a 9x9 inch pan.", "url": "https://example.com/example-page/test/#recipe-step-1", "image": { "@id": "https://www.example.com/uploads/example-image-2.jpg" } }, { "@type": "HowToStep", "name": "Mix dry ingredients", "text": "In a large bowl, combine flour, sugar, baking powder, and salt.", "url": "https://example.com/example-page/test/#recipe-step-2", "image": { "@id": "https://www.example.com/uploads/example-image-3.jpg" } }, { "@type": "HowToStep", "name": "Add wet ingredients", "text": "Mix in the butter, eggs, and milk.", "url": "https://example.com/example-page/test/#recipe-step-3", "image": { "@id": "https://www.example.com/uploads/example-image-4.jpg" } }, { "@type": "HowToStep", "name": "Spread into pan", "text": "Spread into the prepared pan.", "url": "https://example.com/example-page/test/#recipe-step-4", "image": { "@id": "https://www.example.com/uploads/example-image-5.jpg" } }, { "@type": "HowToStep", "name": "Bake", "text": "Bake for 30 to 35 minutes, or until firm.", "url": "https://example.com/example-page/test/#recipe-step-5", "image": { "@id": "https://www.example.com/uploads/example-image-6.jpg" } }, { "@type": "HowToStep", "name": "Enjoy", "text": "Allow to cool and enjoy.", "url": "https://example.com/example-page/test/#recipe-step-6", "image": { "@id": "https://www.example.com/uploads/example-image-7.jpg" } } ] } ] }}