3

有没有办法描述餐厅菜单中每道菜的属性?

尤其是这些字段:名称、描述、价格

或者当您在餐厅属性中指明菜单的 url 时,是否必须祈祷 google 正确解释数据?

4

3 回答 3

2

Schema.org 词汇表(还没有)提供表示餐厅菜单或单个菜单项的类型。

他们的menu属性需要文本或 URL 作为值。如果应该有菜单类型,它将成为另一个预期值。

问题扩展提案:FoodProduct 和 Restaurant Menu with FoodProducts。问这个。它关闭了,引用了更广泛的问题Create a new Food type (进一步帮助 foodWarning 和 recipeIngredient)。它仍在讨论中。

如果您现在需要一些东西,您可以使用引用类型(表示菜单或菜单的分组部分)和类型(表示单个菜单项,带有价格)的hasOfferCatalog属性。OfferCatalogOffer

例如:

<div vocab="http://schema.org/" typeof="Restaurant">
  <section property="hasOfferCatalog" typeof="OfferCatalog">
    <h1 property="name">Menu</h1>
    <ul>

      <li property="itemListElement" typeof="Offer">
        <b property="name">Bread</b> – 
        <span property="price">1.50</span>
        <meta property="priceCurrency" content="EUR" />
      </li>

      <li property="itemListElement" typeof="Offer">
        <b property="name">Water</b> – 
        <span property="price">1.00</span>
        <meta property="priceCurrency" content="EUR" />
      </li>

    </ul>
  </section>
</div>

如果您也想使用该menu属性,您可以添加一个div包含OfferCatalog. 的值menu将是文本内容。

<div vocab="http://schema.org/" typeof="Restaurant">
  <div property="menu">
    <section property="hasOfferCatalog" typeof="OfferCatalog">
      <!-- … -->
    </section>
  </div>
</div>
于 2016-04-13T16:35:14.333 回答
2

有几个选项,取决于(有点)个人喜好:

  • 离开它,看看谷歌是否理解

    menu将值定义为 Text 或 URL,因此提供其中任何一个就足够了。由于未遵循规范,因此执行任何其他操作可能会使 Google 或其他解析器感到困惑。

    这是一篇文章,它显示了一个 URL,它为 Google 提供了一个没有任何架构的菜单,因此该系统确实可以工作。

  • 在 URL 的目标位置提供架构

    ItemList是最通用的列表类型,允许您将itemListElement添加到列表中。这并没有指定列表是菜单,但提供 URL 的菜单属性就足够了。

    或者,优惠允许您指定满足您要求的名称、描述和价格。产品不允许您指定价格,因此此处最好使用优惠。由于 itemListElement 可以是事物,因此您可以在 ItemList 中组合 Offer。

于 2016-04-13T16:29:50.340 回答
0

Schema.org 发布了新的餐厅菜单标记!

这真是个好消息!所以,在这里我要分享一些我自己已经等待了很长时间的东西。

如果您一直梦想有一种适当的方法允许标记多个餐厅菜单以及菜单部分甚至提供差异化​​,那么您会对刷新的 schema.org/restaurant 结构化标记的可能性感到惊讶。

当您访问schema.org/Restaurant页面时,您会注意到的第一件事是menu属性已被替换为hasMenu属性,它现在取代了仍然有效的菜单

所以,直截了当:

如何使用 Schema.org 标记餐厅菜单

在网站的每个页面上,建议将搜索引擎指向正确的方向,以找到菜单的位置。这是一篇不错的文章,涵盖了我在这里整理的大部分内容。

Google 的指导方针规定,我们应该只标记页面上可见的内容,我们不能将整个菜单完全包含在我们的主页标记中,除非整个菜单都在那里发布。相反,我们将简单地使用主页上的hasMenu属性指向菜单页面,如下所示:

<script type="application/ld+json">
{
 "@context": "http://schema.org",
 "@type": "WebSite",
 "name": "Your Restaurant's Name",
 "url": "http://your-restaurant.com/",
 "publisher": {
     "@type": "Restaurant",
     "name": "Your Restaurant's Name",
     "hasMenu": "http://your-restaurant.com/menu/",
     "logo": "http://.....

事实上,在您网站的任何包含一些模式标记的页面上,您都可以使用 hasMenu 属性指向菜单页面的 URL。

当您有多个菜单时:

“hasMenu”: [
{
“@type”: “Menu”,
“name”: “Breakfast”,
“url”: “http://your-restaurant.com/breakfast-menu/”
},
{
“@type”: “Menu”,
“name”: “Lunch”,
“url”: “http://your-restaurant.com/lunch-menu/”
},
{
“@type”: “Menu”,
“name”: “Dinner”,
“url”: “http://your-restaurant.com/dinner-menu/”
}
],
...

启动菜单页面标记:

将注意力转移到实际的菜单页面,假设菜单仅在下午 5:00 到晚上 11:00 之间提供。因此,在菜单页面上,我们的标记将像这样开始:

<script type=”application/ld+json”&gt;
{
“@context”: “http://schema.org”,
“@type”: “Menu”,
“name”: “Our Menu”,
“mainEntityOfPage”: “http://your-restaurant.com/menu/”,
“inLanguage”: “English”,
“offers”: {
“@type”: “Offer”,
“availabilityStarts”: “T17:00”,
“availabilityEnds”: “T23:00”
},

标记菜单的各个部分:

接下来,我们可以开始标记菜单的各个部分和各个菜单项。首先,我们将从开胃菜开始。对于第一个开胃菜,我们将在标记中包含名称、简要说明和价格,这应该是任何菜单项的最低价格。在我们的第二个开胃菜标记示例中,我们还将包含一张图片、营养信息以及它不含麸质的事实:

“hasMenuSection”: [
{
“@type”: “MenuSection”,
“name”: “Appetizers”,
“hasMenuItem”: [
{
“@type”: “MenuItem”,
“name”: “Fried Eggplant”,
“description”: “Served with Italian red gravy.”,
“offers”: {
“@type”: “Offer”,
“price”: “7.95”,
“priceCurrency”: “USD”
}
},
{
“@type”: “MenuItem”,
“name”: “Fried Calamari”,
“description”: “Served with Italian red gravy or honey mustard.”,
“image”: “http://your-restaurant.com/images/fried-calamari.jpg”,
“suitableForDiet”: “http://schema.org/GlutenFreeDiet”,
“nutrition”: {
“@type”: “NutritionInformation”,
“calories”: “573 calories”,
“fatContent”: “25 grams”,
“carbohydrateContent”: “26 grams”,
“proteinContent”: “61 grams”
},
“offers”: {
“@type”: “Offer”,
“price”: “7.95”,
“priceCurrency”: “USD”
}
}
]
},

标记菜单项:

假设我们已经标记了所有的开胃菜,我们准备开始标记下一个菜单部分,在我们的例子中是汤。有时,汤等菜单项有两种或多种尺寸可供选择。我们可以通过为每个选项使用单独的报价标记以及合格数量属性来标记可用选项,如下所示:

{
“@type”: “MenuSection”,
“name”: “Soups”,
“hasMenuItem”: [
{
“@type”: “MenuItem”,
“name”: “Lobster Bisque”,
“offers”: [
{
“@type”: “Offer”,
“price”: “6.75”,
“priceCurrency”: “USD”,
“eligibleQuantity”: {
“@type”: “QuantitativeValue”,
“name”: “Cup”
}
},
{
“@type”: “Offer”,
“price”: “9.95”,
“priceCurrency”: “USD”,
“eligibleQuantity” : {
“@type”: “QuantitativeValue”,
“name”: “Bowl”
}
}
]
},
{
“@type”: “MenuItem”,
“name”: “Creole Seafood Gumbo”,
“offers”: [
{
“@type”: “Offer”,
“price”: “6.75”,
“priceCurrency”: “USD”,
“eligibleQuantity”: {
“@type”: “QuantitativeValue”,
“name”: “Cup”
}
},
{
“@type”: “Offer”,
“name”: “Bowl”,
“price”: “9.95”,
“priceCurrency”: “USD”,
“eligibleQuantity” : {
“@type”: “QuantitativeValue”,
“name”: “Bowl”
}
}
]
}
]
},

把它们放在一起:

在我们标记了所有的汤项目之后,我们可以继续使用相同的格式标记其他菜单部分和项目。就是这样。综上所述,我们的 JSON-LD 菜单标记看起来像这样:

<script type=”application/ld+json”&gt;
{
“@context”:”http://schema.org”,
“@type”:”Menu”,
“name”: “Our Menu”,
“url”: “http://your-restaurant.com/menu/”,
“mainEntityOfPage”: “http://your-restaurant.com/menu/”,
“inLanguage”:”English”,
“offers”: {
“@type”: “Offer”,
“availabilityStarts”: “T17:00”,
“availabilityEnds”: “T23:00”
},
“hasMenuSection”: [
{
“@type”: “MenuSection”,
“name”: “Appetizers”,
“hasMenuItem”: [
{
“@type”: “MenuItem”,
“name”: “Fried Eggplant”,
“description”: “Served with Italian red gravy.”,
“offers”: {
“@type”: “Offer”,
“price”: “7.95”,
“priceCurrency”: “USD”
}
},
{
“@type”: “MenuItem”,
“name”: “Fried Calamari”,
“description”: “Served with Italian red gravy or honey mustard.”,
“image”: “http://your-restaurant.com/images/fried-calamari.jpg”,
“suitableForDiet”: “http://schema.org/GlutenFreeDiet”,
“nutrition”: {
“@type”: “NutritionInformation”,
“calories”: “573 calories”,
“fatContent”: “25 grams”,
“carbohydrateContent”: “26 grams”,
“proteinContent”: “61 grams”
},
“offers”: {
“@type”: “Offer”,
“price”: “7.95”,
“priceCurrency”: “USD”
}
}
]
},
{
“@type”: “MenuSection”,
“name”: “Soups”,
“hasMenuItem”: [
{
“@type”: “MenuItem”,
“name”: “Lobster Bisque”,
“offers”: [
{
“@type”: “Offer”,
“price”: “6.75”,
“priceCurrency”: “USD”,
“eligibleQuantity”: {
“@type”: “QuantitativeValue”,
“name”: “Cup”
}
},
{
“@type”: “Offer”,
“price”: “9.95”,
“priceCurrency”: “USD”,
“eligibleQuantity” : {
“@type”: “QuantitativeValue”,
“name”: “Bowl”
}
}
]
},
{
“@type”: “MenuItem”,
“name”: “Creole Seafood Gumbo”,
“offers”: [
{
“@type”: “Offer”,
“price”: “6.75”,
“priceCurrency”: “USD”,
“eligibleQuantity”: {
“@type”: “QuantitativeValue”,
“name”: “Cup”
}
},
{
“@type”: “Offer”,
“name”: “Bowl”,
“price”: “9.95”,
“priceCurrency”: “USD”,
“eligibleQuantity” : {
“@type”: “QuantitativeValue”,
“name”: “Bowl”
}
}
]
}
]
},
{
“@type”: “MenuSection”,
“name”: “Pastas”,
“description”: “Entrées served with dinner salad or a cup of soup of the day.”,
“hasMenuItem”: [
{
“@type”: “MenuItem”,
“name”: “Veal Parmigiana”,
“description”: “Tender cuts of paneed veal crowned with golden fried eggplant, Italian red gravy, mozzarella, and parmesan; served with spaghetti.”,
“offers”: {
“@type”: “Offer”,
“price”: “17.95”,
“priceCurrency”: “USD”
}
},
{
“@type”: “MenuItem”,
“name”: “Eggplant Parmigiana”,
“description”: “Pan fried eggplant layered and topped with Italian red gravy, mozzarella, and parmesan baked until bubbly; served with spaghetti.”,
“offers”: {
“@type”: “Offer”,
“price”: “14.95”,
“priceCurrency”: “USD”
}
}
]
}
]
}
</script>

餐厅菜单标记的未来

我意识到并不是每个餐厅菜单场景都完美地涵盖了这些新的菜单属性和类型,但希望您现在至少可以开始使用。还要记住,Schema.org 词汇会不断发展,这个特定的模式领域也会不断发展。欢迎您通过Github上的讨论参与 Schema.org 的发展。如果您认为自己有很好的建议,请随时加入对话。

于 2018-02-08T07:50:47.340 回答