酒店列表 XML 参考文档

酒店列表是一个或多个 XML 文件,其中会列出您将为其提供价格信息的所有酒店。酒店列表文件本身不包含价格信息。

酒店列表的根元素是 <listings> 元素,其中包含用于描述您的房源的 <listing> 元素。

初始实现过程中,您可以创建酒店列表,然后在定期维护过程中添加或移除酒店。

确保您的文件符合语法指南。 例如,使用 UTF-8 编码,并通过在 XML 标记中添加 encoding 属性来指定此编码架构。

创建酒店列表后,您可以使用 Hotel Center 手动将其上传到 Google,也可以将其托管在服务器上

查找和修复数据问题

如需查找并修正酒店列表中的数据问题,请参阅以下文章:

产品详情要求

若要投放 Google 酒店广告,酒店列表中的房源必须符合以下条件:

  • 设有可供房客付费入住的房间
  • 有面向公众的固定的实体地点
  • 固定墙和管道
  • 最低入住天数不超过 7 天

“不符合条件”属性的常见示例包括游轮和公寓,因为它们通常不符合 Listing requirements 条件。

露营小屋和其他带固定墙壁、管道和空调(包括柴火炉或丙烷加热器)的露营地符合资格要求。不符合条件的户外住宿包括:

  • 露营地(房客可以住帐篷)
  • 房车营地,房客可携带自己的房车

<listings>

<listings> 是酒店列表的根元素,它包含一个 <language> 元素和至少一个 <listing>

<listings> 元素显示在酒店列表 XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <datum>
    + <listing>

语法

<listings> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="xsi"
    xsi:noNamespaceSchemaLocation="schema_xsd">
  <language> language_code</language>
  <datum> datum_code </datum>
  <listing> listing</listing>
  ...
</listings>

属性

<listings> 元素具有以下属性:

特性 是否必需? 说明
xmlns:xsi 必需 设为 http://www.w3.org/2001/XMLSchema-instance
xsi:noNamespaceSchemaLocation 必需 设为 http://www.gstatic.com/localfeed/local_feed.xsd

子元素

<listings> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<language> Required string 撰写 Feed 时使用的语言。将此元素的值设置为 两个字母的语言代码。例如,en 表示英语。
<datum> Optional enum 此元素用于指定 Feed 中提供的纬度/经度坐标的地理基准或参考模型。如果未提供基准值,此元素的默认值为 WGS84,大多数新型 GPS 设备都会使用该值。东京数据仅适用于日本的地址。

该元素的有效值包括:

  • WGS84
  • wgs84
  • TOKYO
  • tokyo
注意:如需使用默认值 WGS84,请勿在酒店列表中添加 <datum> 元素。
<listing> Required <listing> 描述 Feed 中每个酒店的一个或多个条目。请注意,列表中的每个酒店都必须具有您网站的专属 ID,并且绝不能重复使用此 ID。

示例

结构化地址

以下示例展示了包含结构化地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address format="simple">
      <component name="addr1">6 Acacia Ave</component>
      <component name="addr2">Floor 5</component>
      <component name="city">London</component>
      <component name="province">Greater London</component>
      <component name="postal_code">SW1W 9TQ</component>
    </address>
    <country>GB</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

自由格式地址

以下示例展示了包含自由格式地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address>6 Elm Ave, Boston, MA, 02472</address>
    <country>US</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

可选内容

以下示例展示了部分酒店列表,其商家信息中包含可选的 <content>

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<listing>

酒店列表 <listings> 元素中的酒店定义。

<listing> 元素显示在酒店列表 Feed XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <listing>

语法

<listing> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings ... >
  <listing>
    <!-- Specify <listing>'s child elements in the order shown below. -->
    <id>hotel_ID</id>
    <name>hotel_name</name>
    <address>
      <component name="addr1">street_address_1</component>
      <component name="addr2">street_address_2</component>
      <component name="city">city_name</component>
      <component name="province">province_name</component>
      <component name="postal_code">postal_code</component>
    </address>
    <!-- You can also define an address freeform, although this is not recommended: -->
    <!-- <address>freeform_address</address> -->

    <country>country_code</country>
    <latitude>hotel_latitude</latitude>
    <longitude>hotel_longitude</longitude>
    <phone type="[fax|main|mobile|tdd|tollfree]">phone_number</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>content</content>
  </listing>
</listings>

属性

<listing> 元素没有属性。

子元素

<listing> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<id> Required string 酒店的唯一标识符。

注意:在您的网站中,此值必须始终是唯一的。不要重复使用 ID,否则可能会导致在尝试解决房源匹配问题时出现问题。

<name> Required string 酒店的名称,例如:
<name>Belgrave House</name>
<address> Required Object or string

酒店的完整实际位置。

此元素接受单个属性 format,您必须将该属性设置为 simple

您必须至少提供酒店的街道地址、城市、州/省/自治区/直辖市或区域以及邮政编码。使用 <component> 子元素描述地址的以下各个部分:

  • addr1:酒店的主要街道地址。
  • addr2:次要街道地址(如有必要)。
  • addr3:街道地址的第三部分(如有必要)。
  • city:酒店所在城市的名称。
  • province:酒店所在的州、地区或省的名称。
  • postal_code:酒店的邮政编码。

例如:

<address format="simple">
  <component name="addr1">6 Acacia Ave</component>
  <component name="addr2">Floor 5</component>
  <component name="city">London</component>
  <component name="province">Greater London</component>
  <component name="postal_code">SW1W 9TQ</component>
</address>

或者,您也可以提供“自由格式”地址,但不建议这样做。例如:

<address>6 Elm Ave, Boston, MA, 02472</address>

请注意,邮政信箱或其他仅限邮寄的地址不属于完整的实际地址。

<country> Required string 此商家信息所在的国家/地区。该值必须是两个字母的国家/地区代码。例如美国为“US”,加拿大为“CA”。例如:
<country>US</country>
<latitude> Required* float 与商家信息中所列位置对应的纬度,例如:
<latitude>37.423738</latitude>

此值可使用 Google Maps API 等 GeoCoding 工具生成。

<longitude> Required* float 与商家信息中所列位置对应的经度,例如:
<longitude>-122.090101</longitude>

此值可使用 Google Maps API 等 GeoCoding 工具生成。

<location_precision> Optional integer 当对属性纬度和经度进行混淆处理时,发送的属性位置的精度(以米为单位)。零 (0) 表示不经过混淆处理,并且是确切位置。注意 :此元素仅适用于民宿。
<phone> Required* string

酒店的一个或多个联系电话号码。如果商家信息是商家分支机构,请提供分支地点方面的电话号码(而不是总部的电话号码)。

type 属性可以是以下项之一:

  • fax:传真电话号码。
  • main:主要语音电话号码。
  • mobile:手机号码。
  • tdd:失聪者专用电信设备 (TDD) 电话号码。
  • tollfree:免费电话号码。

例如:

<!-- Singapore (country code +65) -->
<phone type="main">+65 6722-2323</phone>
<!-- U.S. (country code +1) -->
<phone type="fax">+1 408-555-1111</phone>

您至少应提供 main 类型。

<category> Optional string 房源的类型,例如酒店。合作伙伴可以使用任何内部类别来描述他们的房源,例如“商务酒店”“度假村”“汽车旅馆”等。
<content> Optional <content> 用于商家信息的可选详细信息,例如说明、评分和房源特点。

* 电话号码或纬度/经度为必填项。我们建议您同时定义这两者。

示例

结构化地址

以下示例展示了包含结构化地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address format="simple">
      <component name="addr1">6 Acacia Ave</component>
      <component name="addr2">Floor 5</component>
      <component name="city">London</component>
      <component name="province">Greater London</component>
      <component name="postal_code">SW1W 9TQ</component>
    </address>
    <country>GB</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

自由格式地址

以下示例展示了包含自由格式地址的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <!-- The value of <id> must be unique to your site for all time. Do NOT reuse IDs. -->
    <id>123abc</id>
    <name>Belgrave House</name>
    <address>6 Elm Ave, Boston, MA, 02472</address>
    <country>US</country>
    <latitude>35.070374</latitude>
    <longitude>-106.213648</longitude>
    <phone type="main">123-456-7890</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
  </listing>
  ...
</listings>

可选内容

以下示例展示了部分酒店列表,其商家信息中包含可选的 <content>

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<content>

添加商家信息的相关信息,例如评分和评价、酒店设施以及其他详细信息。<content> 元素是可选字段;在 <content> 中,所有子元素都是可选的。

<content> 元素显示在酒店列表 Feed XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <listing>
        + <content>

语法

<content> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings ... >
  <listing>
    <content>
      <!-- Specify <text>'s child elements in the order shown below. -->
      <text type="description">
        <link>listing_link</link>
        <title>listing_title</title>
        <author>listing_author</author>
        <body>listing_description</body>
        <date month="MM" day="DD" year="YYYY"/>
      </text>
      <!-- 0 or more reviews: -->
      <review type="[editorial|user]">
        ...
      </review>
      <!-- 0 or more attributes: -->
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="alternate_hotel_id">alternate_hotel_id</client_attr>
        <client_attr name="custom_0">custom_attribute_0</client_attr>
        <client_attr name="custom_1">custom_attribute_1</client_attr>
        <client_attr name="custom_2">custom_attribute_2</client_attr>
        <client_attr name="custom_3">custom_attribute_3</client_attr>
        <client_attr name="custom_4">custom_attribute_4</client_attr>
        <client_attr name="hotel_brand">hotel_brand</client_attr>
        <client_attr name="num_reviews">number_of_reviews</client_attr>
        <client_attr name="rating">aggregate_rating</client_attr>
      </attributes>
      <!-- a picture of the hotel or property-->
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main Hotel Picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

属性

<content> 元素没有属性。

子元素

<content> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<text type="description"> Optional Object

与提供商的商家信息相关联的网页。 具有以下子元素:

  • <link>:指向说明的链接。在此元素中包含“http://”或
    “https://”(可选)。
  • <title>:说明的标题(可选)。
  • <author>:说明的作者(可选)。
  • <body>:说明的正文(必需)。
  • <date>:说明的日期(可选)。
  • 注意:这些元素必须按上述顺序显示。

<review type="[editorial|user]"> Optional <review>

包含商家信息的用户评价或编辑评价。您的商品详情可以包含任意类型的评价,数量不限。

您无需在 <listing> 元素中包含针对某个属性的所有评价;此元素用于添加可说明此商家信息特色或质量的选定评价。

<attributes> Optional Object

包含 0 个或更多个提供相应属性详情的 <client_attr> 子元素。子元素使用以下语法:

<client_attr name="attribute_name">attribute_value<client_attr>

如需查看子元素的列表和说明,请参阅 <attributes>

所有 <client_attr> 元素都是可选的。

如果存在 <website> 子元素,则必须将其放置在任何 <client_attr> 元素之前。

<image> Optional Object 重复的标记,包含详细的图片信息。

示例

以下示例展示了包含 <content> 元素的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<review>

包含用户评价或编辑评价。您无需在 <listing> 元素中添加对商家信息的所有评价;此元素可让您添加可表明此商家信息的功能或质量的选定评价。

<review> 元素显示在酒店列表 Feed XML 层次结构中的以下位置:

+ <listings>
    + <language>
    + <listing>
        + <content>
            + <review>

语法

<review> 元素使用以下语法:

<?xml version="1.0" encoding="UTF-8"?>
<listings ... >
  <listing>
    <content>
      ...
      <!-- Specify <review>'s child elements in the order shown below. -->
      <review type="editorial">
        <link>review_link</link>
        <title>review_title</title> <!-- Title is for reviews of type "editorial" only -->
        <author>review_author</author>
        <rating>review_rating</rating>
        <body>review_text</body>
        <date>review_date</date>
        <servicedate>review_servicedate</servicedate>
      </review>
      <review type="user">
        <link>review_link</link>
        <author>review_author</author>
        <date month="MM" day="DD" year="YYYY"/>  <!-- Date is for reviews of type "user" only -->
        <servicedate month="MM" day="DD" year="YYYY"/>  <!-- Service Date is for reviews of type "user" only -->
        <rating>review_rating</rating>
        <body>review_text</body>
      </review>
    </content>
  </listing>
</listings>

属性

<review> 元素具有以下属性:

特性 是否必需? 说明
type Required 评价的类型。设置为以下值之一:
  • editorial:网站或其他审核机构所做的审核。
  • user:最终用户的评价。

子元素

<review> 元素具有以下子元素:

子元素 是否必需? 类型 说明
<link> Optional string 指向评价的链接。在该元素中添加“http://”或“https://”。
<title> Optional string (仅限编辑评价)评价的标题。
<author> Optional string 评价的作者,例如“Susan von Trapp”。如果评价未注明出处,也可以是出现相应评价的网站或出版物的名称。
<rating> Optional string 一个介于 0 到 10(含)的浮点数,表示评价得分。例如,"8.9"。
<body> Optional string 评价的文字。此元素不应包含 HTML。
<date month="MM" day="DD" year="YYYY"/> Optional Object (仅限用户评价)评价的日期,您可以使用此元素的以下属性指定:
  • day:一个月中的第几天;例如“7”。
  • month:月份,其中 1 = 1 月 ... 12 = 12 月。
  • year:四位数年份;例如“2023”。

例如,“2023 年 6 月 7 日”的书写方式如下:

<date month="6" day="7" year="2023"/>
<servicedate month="MM" day="DD" year="YYYY"/> Optional Object (仅限用户评价)评价者访问要评价的商家信息的日期。其格式与上面的 <date> 相同。

例如,“2023 年 6 月 7 日”的书写方式如下:

<servicedate month="6" day="7" year="2023"/>

如果未填写 <servicedate> 的月份和年份,评价可能不会显示。日期不是必填字段。

请注意,仅当评价的 typeeditorial 时,<title> 才是 <review> 的有效子元素;<date> 仅在 typeuser 时有效。

示例

以下示例展示了部分酒店列表,其商家信息中包含编辑评价和用户评价:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <id>123456</id>
    <name>My Apartment</name>
    <address format="simple">
      <component name="addr1">1 Sandstone Building</component>
      <component name="city">Los Angeles</component>
      <component name="postal_code">90210</component>
      <component name="province">CA</component>
    </address>
    <country>US</country>
    <latitude>40.730610</latitude>
    <longitude>-73.935242</longitude>
    <phone type="main">12345678</phone>
    <category>hotel</category> <!-- You can use whatever property type categories you wish -->
    <content>
      <text type="description">
        <link>https://examplelisting.com/listings/12345</link>
        <title>3 bedrooms with ocean views</title>
        <body>Stay in this newly renovated 3BR house with ocean views.</body>
        <date month="7" day="23" year="2023"/>
      </text>
      <review type="editorial">
        <link>https://example.com/reviews/42</link>
        <title>A little piece of heaven</title>
        <author>EXAMPLE.COM</author>
        <rating>8</rating>
        <body>This place is really good.</body>
      </review>
      <review type="user">
        <link>https://exampleperson.org/reviews/82</link>
        <author>Susan von Trapp</author>
        <rating>6</rating>
        <body>Not a bad place, but I prefer to be closer to the beach.</body>
        <date day="6" month="7" year="2023"/>
        <servicedate day="16" month="6" year="2023"/>
      </review>
      <attributes>
        <website>https://hotel.example.com</website>
        <client_attr name="rating">8.2</client_attr>
        <client_attr name="num_reviews">14</client_attr>
      </attributes>
      <image type="photo" url="https://image_url">
        <link>https://image_url</link>
        <title>Main hotel picture</title>
      </image>
    </content>
  </listing>
  ...
</listings>

<attributes>

<attributes> 标记可用于描述酒店设施以及对房源的评分和评价进行分类。

+ <listings>
    + <language>
    + <listing>
        + <content>
            + <review>
            + <attributes>

子元素

子元素 是否必需? 说明
<website> Optional 酒店的主要网站,如果存在,则必须放置在第一个 <client_attr> 元素之前。示例
<website>https://hotel.example.com</website>
<client_attr name="attribute_name"> Optional 可以使用支持的 attribute_name 民宿 attribute_name 指定的属性的附加特征或“属性”。

attribute_name 占位符的值

下表列出了 <client_attr name="attribute_name"> 元素中 attribute_name 的有效值。

attribute_name 的值 说明 有效的内容值
alternate_hotel_id 房源的备用标识符。如果您需要将一个房源标识符用于 Feed 信息,并需要另一个用于预订引擎的酒店标识符,则使用单独的 ID 会非常有用。 任意字符串值
custom_[0-4] 任何字符串类型自定义属性。这些信息不会向用户显示。 任意字符串值
hotel_brand 此酒店所属品牌,例如,“Marriott”或“Hilton”。此名称不会向用户显示,但可用于对酒店进行分组。 任意字符串值
lodging Lodging proto 中所有可用字段的编码表示形式。 已编码Lodging proto,采用 Base64 编码的字符串
num_reviews 商家信息的评价数量。 任何非负整数。
rating 表示总体房源评分的浮点数。 此数字通常介于 0-5、0-10 或 0-100 之间,但您可以使用任何表示您分级制度的范围。

民宿的 attribute_name 占位符的值

请参阅民宿专用属性和 XML 示例

<image>

+ <listings>
    + <language>
    + <listing>
        + <content>
            + <review>
            + <attributes>
            + <image>

图片用于在房源 ID 中显示房源。使用的所有图片都必须遵循以下准则:

  • 建议的图片宽高比为 4:3。
  • 图片网址必须可供 Googlebot 图片抓取工具访问。
  • 如果您的网站在根目录下设置了 robots.txt,请验证其是否包含下面所示的两个选项之一:

    1. 允许 Googlebot 抓取工具抓取您网站的内容(包括图片)。

      • User-agent: Googlebot
      • Allow: /
    2. 允许 Googlebot 图片抓取工具抓取您网站上的图片。

      • User-agent: Googlebot-Image
      • Allow: /
  • 不得上传图片或网站的屏幕截图。图片必须是原始和真实的图片或照片。

属性

  • 如果图片是广告,则为 "ad"
  • 如果图片是餐厅菜单,则为 "menu"
  • 如果图片是商家照片,则为 "photo"
属性名称 是否必需? 形式 说明
type Required Text

图片必须是下列内容之一:

url Required Text 完整尺寸的图片的网址。使用网址属性指定要在该网页上使用的图片。
width Required A non-negative integer 图片的宽度,以像素为单位(建议大于 720 像素)
height Required A non-negative integer 图片的高度,以像素为单位(建议大于 720 像素)

子元素

子元素 是否必需? 说明
<link> 已请求,但对于本地照片商家信息是必需的 此标记包含您网站上显示相关图片的网页的最新有效网址。不包含图片本身的网址。 示例
<link><http://www.example.com/magic_pizza/></link>
<title> 已请求 此标记包含图片的标题。示例
<title>"Luxury Apartment"</title>
<author> 不需要 内容作者的姓名。该值可以是用户名,也可以是格式为“Firstname Lastname”的全名。
<date> 必需

此标记用于标识内容项的创建日期。您必须输入年、月、日,如以下示例所示:

<date month="6" day="7" year="2023"/>

示例

以下示例展示了包含图片标记的部分酒店列表:

<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
  <language>en</language>
  <listing>
    <content>
      <review>
      </review>
      <attributes>
      </attributes>
      <image type="photo" url="https://image_url" width="400" height="300">
        <link>https://image_url</link>
        <title>Apartment at Sandstone</title>
        <author>Jessica Landlord</author>
        <date month="6" day="7" year="2023"/>
      </image>
    </content>
  </listing>
  ...
</listings>

语法指南

创建基于 XML 的酒店列表时,请遵循以下准则:

  • 使用 Google 的 XSD 架构验证您的酒店列表 XML 文件。

  • 请使用 UTF-8 编码。您可以通过在 XML 标记中添加 encoding 属性来指定此编码架构,如以下示例所示。

  • 您可以通过 CDATA 部分在 Feed 中指定数据值。如果您使用 CDATA 部分,请勿转义特殊字符。

  • 对于不在 CDATA 部分(包括网址)的数据值,请使用转义代码。您可以使用实体代码或字符代码来表示这些特殊字符。下表列出了您可以使用的常见实体和字符代码:

    基于字符, 实体 字符代码
    和号 (&) &amp; &#38;
    英文单引号 (') &apos; &#39;
    英文双引号 (") &quot; &#34;
    大于 (>) &gt; &#62;
    小于 (<) &lt; &#60;
  • 省略不包含数据的 XML 元素。例如,如果您没有酒店的经纬度信息,则不应包含空的 <latitude/><longitude/> 元素。

  • 在任何情况下都不要在 XML 元素中使用 HTML(即使进行了转义)。

  • 要在上传之前验证您的 Feed,您可以使用本地 Feed XSD http://www.gstatic.com/localfeed/local_feed.xsd。

  • 如需在 Feed 中使用注释,请将注释封装在 <!----> 标记中,如以下示例所示:

    <!-- This is a comment -->
    
  • 请务必关闭用户 <review> 中的 <date> 元素。例如:

    <date day="2" month="12" year="2017"/>