飯店清單 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 這個元素會為動態饋給中提供的經緯度座標指定地理資料基準或參考模型。如未提供基準值,大多數新式 GPS 裝置都會使用這個元素的預設值WGS84。東京 Datum 僅適用於日本的地址。

這個元素的有效值如下:

  • 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, 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, 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 (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> 元素會顯示在飯店清單動態饋給 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,請採用各不相同的專屬 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> 非必要 內容作者的名稱。這個值可以是使用者名稱或全名 (格式為「名字姓氏」)。
<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"/>