酒店列表是指一个或多个 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 的默认值,请勿在酒店列表中添加 <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 Unit 3, 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 | 酒店的完整实际位置。 此元素接受单个属性 您至少必须提供酒店的街道地址、城市、州/省或地区以及邮政编码。使用
例如: <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 Unit 3, Boston, MA, 02472</address> 请注意,邮政信箱或其他仅限邮寄的地址不属于完整的实际地址。 |
<country> | Required | string | 商家信息所在的国家/地区。该值必须是两个字母的国家/地区代码。例如,美国为“US”,加拿大为“CA”。例如:<country>US</country> |
<latitude> | Required* | float | 与商家信息中所列位置对应的纬度,例如:
<latitude>37.423738</latitude> 此值可以使用 Google Maps API 等地理编码工具生成。 |
<longitude> | Required* | float | 与商家信息中所列位置对应的经度,例如:
<longitude>-122.090101</longitude> 此值可以使用 Google Maps API 等地理编码工具生成。 |
<location_precision> | Optional | integer | 在经过混淆处理的房源经纬度的情况下,发送的房源位置的精确度(以米为单位)。零 (0) 表示没有混淆,并且是确切位置。注意 :此元素仅适用于民宿。 |
<phone> | Required* | string | 酒店的一个或多个联系电话。如果商家信息是商家分店,请提供相应分店营业地点的电话号码(而非总部的电话号码)。
例如: <!-- Singapore (country code +65) --> <phone type="main">+65 6722-2323</phone> <!-- U.S. (country code +1) --> <phone type="fax">+1 408-555-1111</phone> 您至少应提供 |
<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 Unit 3, 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 |
Optional | Object | 与提供商的商家信息相关联的网页。 具有以下子元素:
注意:这些元素必须按上述顺序显示。 |
<review |
Optional | <review> |
包含商家信息的用户评价或编辑评价。您的商家信息可以包含任意数量的任意类型的评价。 您无需在 |
<attributes> | Optional | Object | 包含 0 个或更多 <client_attr name="attribute_name">attribute_value<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 | 评价类型。设置为以下值之一:
|
子元素
<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 | (仅限用户评价)评价日期,您可以使用此元素的以下属性指定:
例如,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> 中的月份和年份,评价可能不会显示。日期为非必填项。 |
请注意,只有在评价的 type
为 editorial
时,<title>
才是 <review>
的有效子元素;只有在 type
为 user
时,<date>
才有效。
示例
以下示例展示了部分酒店列表,其中包含包含编辑信息和用户评价的商家信息:
<?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 之间,但您可以使用任何代表评分系统的范围。例如,如果 rating_scale 为 5,房源评分应为 3 或 4。 注意:如果未指定,默认 rating_scale 为 0-10。 |
民宿的 attribute_name 占位符的值
请参阅特定于民宿的属性和 XML 示例。
<image>
+ <listings>
+ <language>
+ <listing>
+ <content>
+ <review>
+ <attributes>
+ <image>
图片用于在商家信息 ID 中显示房源。使用的所有图片都必须遵循以下准则:
- 建议的图片宽高比为 4:3。
- 图片网址必须可供 Googlebot 图片抓取工具访问。
如果您的网站在根目录下包含 robots.txt,请验证该文件是否包含以下两个选项之一:
允许 Googlebot 抓取工具抓取您网站的内容(包括图片)。
- User-agent: Googlebot
- Allow: /
允许 Googlebot Image 抓取工具抓取您网站上的图片。
- User-agent: Googlebot-Image
- Allow: /
不允许使用图片或网站的屏幕截图。图片必须是原创且真实的图片或照片。
属性
"ad"
(如果图片是广告)"menu"
(如果图片是餐厅菜单)"photo"
(如果图片是商家的照片)
属性名称 | 是否必需? | 格式 | 说明 |
---|---|---|---|
type | Required | Text | 图片必须是以下各项之一: |
url | Required | Text | 全尺寸图片的网址。使用 url 属性指定要在该页面上使用的图片。 |
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> | 不需要 | 内容作者的姓名。该值可以是用户名,也可以是采用“名字 姓氏”格式的全名。 |
<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
部分的数据值(包括网址),请使用转义代码。您可以使用实体代码或字符代码来表示这些特殊字符。下表列出了您可以使用的常见实体和字符代码:字符 实体 字符代码 和号 (&) & & 英文单引号 (') ' ' 英文双引号 (") " " 大于 (>) > > 小于 (<) < < 省略不包含数据的 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"/>