飯店清單 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 撰寫動態饋給時使用的語言。將這個元素的值設為 雙字母的語言代碼。例如 en 代表英文。
<datum> Optional enum 這個元素會針對動態饋給中提供的經緯度座標,指定測地基準或參考模型。如未提供基準值,則這個元素的預設值是 WGS84,這是大多數新式 GPS 裝置會使用的。東京地區僅適用於日本的地址。

這個元素的有效值如下:

  • WGS84
  • wgs84
  • TOKYO
  • tokyo
注意:如要使用 WGS84 的預設值,請勿在飯店清單中加入 <datum> 元素。
<listing> Required <listing> 動態饋給中每間飯店的一或多個項目。請注意,清單中的每間飯店都必須有網站專屬的 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> 元素會顯示在飯店清單動態饋給 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。

注意:這個值在網站上不得重複。請不要重複使用 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 Unit 3, 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 (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 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> 元素會顯示在飯店清單動態饋給 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> 元素會顯示在飯店清單動態饋給 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 來指定房源的其他特性或「屬性」。

屬性名稱預留位置的值

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

attribute_name 的值 說明 有效內容值
alternate_hotel_id 房源的備用 ID。如果您可能需要為動態饋給資訊和預訂引擎使用另一個房源 ID,採用各不相同的專屬 ID 會有所幫助。 任何字串值
custom_[0-4] 任何字串類型的自訂屬性。使用者不會看到這些資訊。 任何字串值
hotel_brand 這間飯店隸屬的品牌,例如「萬豪國際」或「希爾頓」。使用者不會看到這項資訊,但可以用於將飯店分組。 任何字串值
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 原尺寸圖片的網址。請使用 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> 非必要 內容作者的姓名。值可以是使用者名稱或全名,格式為「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 個部分指定資料值。如果您使用 CDATA 區段,請勿逸出特殊字元。

  • 請針對非 CDATA 區段的資料值使用逸出碼,包括網址。您可以使用實體代碼或字元代碼來代表這些特殊字元。下表列出了您可以使用的常見實體和字元代碼:

    字元 實體 字元代碼
    AND 符號 (&) &amp; &#38;
    單引號 (') &apos; &#39;
    雙引號 (") &quot; &#34;
    大於 (>) &gt; &#62;
    小於 (<) &lt; &#60;
  • 省略不含資料的 XML 元素。舉例來說,如果沒有飯店的經緯度,就不要加入空白的 <latitude/><longitude/> 元素。

  • 在任何情況下,請勿在 XML 元素中使用 HTML (即使已逸出)。

  • 如要在上傳之前驗證動態饋給,您可以使用本地動態饋給 XSD http://www.gstatic.com/localfeed/local_feed.xsd。

  • 如要在動態饋給中使用註解,請將註解納入 <!----> 標記中,如以下範例所示:

    <!-- This is a comment -->
    
  • 請務必關閉使用者 <review> 中的 <date> 元素。例如:

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