With the version 3.1, schema.org brings a lot of new annotation power to hotels. Previously accommodation providers were able to annotate the core data of their business, like name, phone, address and more, but the newly released version 3.1 brings that to a new level and allows the annotation of rooms, features and services and even lets the accommodation owners annotate their room offers on the website. This article shows how this is done on a short JSON-LD example.
The example starts with the straight forward definition of the hotel with some properties like name, URL, address and others. The property makesOffer requires an Offer which comes with a property itemOffered, which has our special attention here.
The itemOffered requires, as stated in the documentation, either a Product or Service. The alleged problem: HotelRoom is neither. Here schema.org comes up with the concept of Multiple Typed Entities (MTE). One might think now “What is new about that, Hotel itself is an Organization and a Place”, but this is different. In the case of the HotelRoom we have to make a multi typing on the instance level instead of the vocabulary level.
This works simply by setting the @type of our annotated hotel room to HotelRoom AND Product – in the JSON-LD implementation we use an array for that. The rest of the example is straight forward: the room gets a bed, a description, a name and values for occupancy.
{ "@context": "http://schema.org/", "@type": "Hotel", "name": "Landgasthof Adler", "openingHours": "We-Mo 10:00-20:00", "paymentAccepted": "Cash, credit card", "url": "http://www.landgasthof-adler.at/", "address": { "@type": "PostalAddress", "addressCountry": "Austria", "addressLocality": "Hinterhornbach", "addressRegion": "Tirol", "postalCode": "6642", "streetAddress": "Hinterhornbach 17" }, "makesOffer": { "@type": "Offer", "availability": "InStock", "name": "Enzian Room", "itemOffered": { "@type": ["HotelRoom", "Product"], "bed": { "@type": "BedDetails", "numberOfBeds": 1 }, "description": "Double Room with Shower", "name": "Enzian Room", "numberOfRooms": 1, "occupancy": { "@type": "QuantitativeValue", "maxValue": 3, "minValue": 1 } } } }
For further information about schema.org, follow their blog and brows their GitHub issues.