特定の成分に関する記事を作成し、それらの栄養成分を提供します。
私の記事のページには、Article
タイプの現在のスキーマがあり、これは私が知っていることから完璧に機能します。しかし、私はウェブページに栄養ラベルを含む別のスキーマが欲しいです。
コードに別のスキーマを追加できる場合:
script
タグに入れることはできますか?<!-- JSON-LD markup generated by Google Structured Data Markup Helper. -->
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Article",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "http://cathscafe.example.com/"
},
"name" : "Olive Oil Review - 2019",
"headline" : "Olive Oil Review",
"author" : {
"@type" : "Person",
"name" : "Christopher Karam"
},
"datePublished" : "2019-01-04",
"dateModified" : "2019-01-04",
"image" : "https://static1.squarespace.com/static/59a7820e2994ca11766093d3/t/5b00a06f575d1f8e6e07c981/1526767728080/olive-oil-fat-healthy-food-dietary-my-diet-goal-small-hd.jpg",
"articleSection" : "Wellness",
"articleBody" : "Olive oil is a liquid fat obtained from olives, a traditional tree crop of the Mediterranean. The oil is produced by cold pressing whole olives...",
"url" : "https://mydietgoal.com/olive-oil",
"publisher" : {
"@type" : "Organization",
"name" : "MyDietGoal",
"logo" : {
"@type": "ImageObject",
"name": "MyDietGoalLogo",
"url" : "https://static1.squarespace.com/static/59a7820e2994ca11766093d3/t/5b6f96c6032be42d1403dd79/1551652043684.jpg",
"width" : "250",
"height" : "250"
}},
"aggregateRating" : {
"@type" : "AggregateRating",
"ratingValue" : "5.0",
"bestRating" : "5.0",
"ratingCount" : "6"
}
}
</script>
schema.orgによるとNutritionInformationisメニュー項目またはレシピにのみ適用されます 。他の何かをマークアップしようとしている場合は、すべての必須フィールドでこれをエミュレートする必要があります。
同じ<script>
タグに別のオブジェクトを配置することは技術的には正しいはずですが、 JSON array [] を使用する必要があります。 Googleのバリデータ も Yandex 'バリデータ も、そのようなスニペットに対して警告やエラーを返しません。
<script type="application/ld+json">
[
{
"@context" : "http://schema.org",
"@type" : "Article",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "http://cathscafe.example.com/"
},
"name" : "Olive Oil Review - 2019",
"headline" : "Olive Oil Review",
"author" : {
"@type" : "Person",
"name" : "Christopher Karam"
},
"datePublished" : "2019-01-04",
"dateModified" : "2019-01-04",
"image" : "https://static1.squarespace.com/static/59a7820e2994ca11766093d3/t/5b00a06f575d1f8e6e07c981/1526767728080/olive-oil-fat-healthy-food-dietary-my-diet-goal-small-hd.jpg",
"articleSection" : "Wellness",
"articleBody" : "Olive oil is a liquid fat obtained from olives, a traditional tree crop of the Mediterranean. The oil is produced by cold pressing whole olives...",
"url" : "https://mydietgoal.com/olive-oil",
"publisher" : {
"@type" : "Organization",
"name" : "MyDietGoal",
"logo" : {
"@type": "ImageObject",
"name": "MyDietGoalLogo",
"url" : "https://static1.squarespace.com/static/59a7820e2994ca11766093d3/t/5b6f96c6032be42d1403dd79/1551652043684.jpg",
"width" : "250",
"height" : "250"
}},
"aggregateRating" : {
"@type" : "AggregateRating",
"ratingValue" : "5.0",
"bestRating" : "5.0",
"ratingCount" : "6"
}
},
{
"@context": "http://schema.org",
"@type": "Recipe",
"author": "John Smith",
"cookTime": "PT1H",
"datePublished": "2009-05-08",
"description": "This classic banana bread recipe comes from my mom -- the walnuts add a Nice texture and flavor to the banana bread.",
"image": "bananabread.jpg",
"recipeIngredient": [
"3 or 4 ripe bananas, smashed",
"1 Egg",
"3/4 cup of sugar"
],
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": "http://schema.org/Comment",
"userInteractionCount": "140"
},
"name": "Mom's World Famous Banana Bread",
"nutrition": {
"@type": "NutritionInformation",
"calories": "240 calories",
"fatContent": "9 grams fat"
},
"prepTime": "PT15M",
"recipeInstructions": "Preheat the oven to 350 degrees. Mix in the ingredients in a bowl. Add the flour last. Pour the mixture into a loaf pan and bake for one hour.",
"recipeYield": "1 loaf",
"suitableForDiet": "http://schema.org/LowFatDiet"
}
]
</script>
両方を別々の<script>
タグに入れると、結果は同じになります。
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Article",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "http://cathscafe.example.com/"
},
"name" : "Olive Oil Review - 2019",
"headline" : "Olive Oil Review",
"author" : {
"@type" : "Person",
"name" : "Christopher Karam"
},
"datePublished" : "2019-01-04",
"dateModified" : "2019-01-04",
"image" : "https://static1.squarespace.com/static/59a7820e2994ca11766093d3/t/5b00a06f575d1f8e6e07c981/1526767728080/olive-oil-fat-healthy-food-dietary-my-diet-goal-small-hd.jpg",
"articleSection" : "Wellness",
"articleBody" : "Olive oil is a liquid fat obtained from olives, a traditional tree crop of the Mediterranean. The oil is produced by cold pressing whole olives...",
"url" : "https://mydietgoal.com/olive-oil",
"publisher" : {
"@type" : "Organization",
"name" : "MyDietGoal",
"logo" : {
"@type": "ImageObject",
"name": "MyDietGoalLogo",
"url" : "https://static1.squarespace.com/static/59a7820e2994ca11766093d3/t/5b6f96c6032be42d1403dd79/1551652043684.jpg",
"width" : "250",
"height" : "250"
}},
"aggregateRating" : {
"@type" : "AggregateRating",
"ratingValue" : "5.0",
"bestRating" : "5.0",
"ratingCount" : "6"
}
}
</script>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Recipe",
"author": "John Smith",
"cookTime": "PT1H",
"datePublished": "2009-05-08",
"description": "This classic banana bread recipe comes from my mom -- the walnuts add a Nice texture and flavor to the banana bread.",
"image": "bananabread.jpg",
"recipeIngredient": [
"3 or 4 ripe bananas, smashed",
"1 Egg",
"3/4 cup of sugar"
],
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": "http://schema.org/Comment",
"userInteractionCount": "140"
},
"name": "Mom's World Famous Banana Bread",
"nutrition": {
"@type": "NutritionInformation",
"calories": "240 calories",
"fatContent": "9 grams fat"
},
"prepTime": "PT15M",
"recipeInstructions": "Preheat the oven to 350 degrees. Mix in the ingredients in a bowl. Add the flour last. Pour the mixture into a loaf pan and bake for one hour.",
"recipeYield": "1 loaf",
"suitableForDiet": "http://schema.org/LowFatDiet"
}
</script>
これについて詳しくは here を参照してください。