简体   繁体   English

schema.org 将 ItemList 嵌套到 Restaurant

[英]schema.org nesting ItemList into Restaurant

I need to markup an item list (properties of a restaurant like "cocktailbar", "terrace", "free parking lots") on a restaurant website.我需要在餐厅网站上标记项目列表(餐厅的属性,如“鸡尾酒吧”、“露台”、“免费停车场”)。 Schema.org defines the type "Restaurant" in the following chain: Schema.org 在以下链中定义了“Restaurant”类型:

Thing -> Organization -> Local Business -> FoodEstablishment -> Restaurant事物 -> 组织 -> 本地企业 -> 食品企业 -> 餐厅

Within the itemscope of "Restauarant" there's no "ItemList" defined.在“餐厅”的项目范围内,没有定义“项目列表”。 Is it possible to add a "ItemList" within a "Restaurant" markup block although "ItemList" is defined in this chain?:尽管在此链中定义了“ItemList”,但是否可以在“Restaurant”标记块中添加“ItemList”?:

Thing -> CreativeWork -> ItemList事物 -> CreativeWork -> 项目列表

Thanks!谢谢!
ninsky宁斯基

The superficial answer is "No".肤浅的答案是“不”。 The only guaranteed processing of ItemList will be within the context of CreativeWork. ItemList 的唯一保证处理将在 CreativeWork 的上下文中进行。

The more vague answer would be "possibly?".更模糊的答案是“可能?”。 There's nothing stopping you from just using it.没有什么能阻止你使用它。 Worst case scenario, it'll just be ignored.最坏的情况,它会被忽略。 Google might do something with it or it may not.谷歌可能会用它做点什么,也可能不会。

As it stands, though, there's simply not guaranteed support for any sort of list structure within the item types you're using.但是,就目前而言,根本不保证支持您正在使用的项目类型中的任何类型的列表结构。

As far as I know, ItemLists for such features of Restaurant are not generally understood.据我所知,Restaurant 这类功能的 ItemLists 并没有被普遍理解。 I'll investigate more structured ways of doing this, but it might be that the content is best represented in the description for now.我将研究更结构化的方法来做到这一点,但现在可能是内容在描述中得到最好的体现。

Technically, you could use the itemprop contentLocation of the ItemList to reference the Restaurant.从技术上讲,您可以使用 ItemList 的 itemprop contentLocation 来引用餐厅。 For example, you could use the following code:例如,您可以使用以下代码:

<!doctype html>
    <head>
        <title>My Restaurant</title>
    </head>
    <body>
        <div itemscope itemtype="http://schema.org/ItemList">
            <div itemprop="contentLocation" itemscope itemtype="http://schema.org/Restaurant">
            <span itemprop="name">My Restaurant</span>
        </div>
        <ul>
            <li itemprop="itemListElement">cocktailbar</li>
            <li itemprop="itemListElement">terrace</li>
            <li itemprop="itemListElement">free parking lots</li>
        </ul>
    </div>
</body>
</html>

The example code results in the following Google Rich Snippet Tool:示例代码生成以下 Google Rich Snippet Tool:

Item
    Type: http://schema.org/itemlist
    contentlocation = Item( 1 )
    itemlistelement = cocktailbar
    itemlistelement = terrace
    itemlistelement = free parking lots
Item 1
    Type: http://schema.org/restaurant
    name = My Restaurant  

You might instead want to use the itemprop "about" instead.您可能想改用 itemprop "about"。 If it makes sense to you, then it MIGHT make sense to a bot.如果它对您有意义,那么它可能对机器人有意义。 If it doesn't make sense to you, then I would not force it.如果它对你没有意义,那么我不会强迫它。

Yes, but not with an ItemList.是的,但不是使用 ItemList。 An ItemList is a Creative Work and "is used for something created by its author specifically as a list, such as a 'Top 10 List'" (from http://www.HTML-5.com/microdata/schemas/item-list.html ). ItemList 是一种创意作品,“用于由其作者创建的特定列表,例如‘Top 10 List’”(来自http://www.HTML-5.com/microdata/schemas/item-列表.html )。 It's not a data type and therefore should not be used as if it were a generic collection of items (see http://www.HTML-5.com/microdata/index.html#item-list-vs-html-list ).它不是一种数据类型,因此不应将其用作项目的通用集合(参见http://www.HTML-5.com/microdata/index.html#item-list-vs-html-list ) .

Instead, for such a container you would use the "containedIn" property with the "itemref" attribute.相反,对于这样的容器,您可以使用带有“itemref”属性的“containedIn”属性。 There is a good example of a bar and restaurant in the same location here:这里有一个在同一位置的酒吧和餐厅的好例子:

http://www.HTML-5.com/microdata/schemas/food-establishment.html#examples http://www.HTML-5.com/microdata/schemas/food-establishment.html#examples

Although that example defines the bar and restaurant as "contactPoints" because they have their own phone and/or web URL, you would probably omit that for things like the parking lot (unless there's a valet stand with a phone.), The fact that the itemref property of all the features ("cocktailbar" - probably a "BarOrPub", "terrace" - possbily a "Place". "free parking lots" - maybe just a "Thing") of the establishment reference the same place provides the relationship you were seeking.尽管该示例将酒吧和餐厅定义为“contactPoints”,因为它们拥有自己的电话和/或 web URL,但对于停车场之类的事情,您可能会忽略这一点(除非有带电话的代客服务台)。 itemref 属性(“cocktailbar” - 可能是“BarOrPub”、“terrace” - 可能是“Place”。“免费停车场” - 可能只是“Thing”)引用同一地点提供你正在寻找的关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM