HTML5 tags and microdata for a list of apartments

∥☆過路亽.° 提交于 2020-01-24 18:22:30

问题


which HTML5 tags and microdata schema should I use to describe a list of apartments to rent?

They have the following properties:

  • Name
  • Image
  • Unique number
  • Location
  • Description
  • Price

My HTML structure is currently like this:

<section id="featured">
    <h2>Featured appartaments</h2>
    <ul>
        <li>
            <article>
                <h3><a href="javascript:void(0);">House #1</a></h3>
                <img src="http://placehold.it/250x150/" alt="House #1" />
                <p>Ref. 40</p>
                <p>My location</p>
                <p>My description.</p>
                <p>Price: € 500.000,00</p>
            </article>
        </li>
        <li>
            <article>
                <h3><a href="javascript:void(0);">House #2</a></h3>
                <img src="http://placehold.it/250x150/" alt="House #2" />
                <p>Ref. 41</p>
                <p>My location</p>
                <p>My description.</p>
                <p>Price: € 500.000,00</p>
            </article>
        </li>
    </ul>
</section>

Thanks!


回答1:


Update (2016): Schema.org now has new types/properties for accommodations, including an Apartment type. See the update in my related answer. I’ll leave the old answer below unchanged for now.


If you want to use the Schema.org vocabulary:

Each apartment could be represented by a Product (bold emphasis mine):

Any offered product or service. For example: a pair of shoes; a concert ticket; the rental of a car; a haircut; or an episode of a TV show streamed online.

The offer to rent such an apartment could be represented by an Offer:

An offer to transfer some rights to an item or to provide a service—for example, an offer to sell tickets to an event, to rent the DVD of a movie, to stream a TV show over the internet, to repair a motorcycle, or to loan a book.

For linking from the Product to the Offer, use the offers property (resp. the itemOffered property for the other direction).

It’s also possible to use Offer on its own (without using Product at all), and judging from your example, this might make sense here. (Using Offer and Product makes sense when you have different offers for the same apartment, i.e., you can give the metadata for the apartment in the Product and use separate Offer items for different dates etc.).

So using your example, it could look like:

<article itemscope itemtype="http://schema.org/Offer">
  <h3 itemprop="name"><a itemprop="url" href="">House #1</a></h3>
  <img itemprop="image" src="http://placehold.it/250x150/" alt="House #1" />
  <p itemprop="serialNumber">Ref. 40</p>
  <p>My location</p>
  <p itemprop="description">My description.</p>
  <p>Price: € <span itemprop="price">500.000,00</span> <meta itemprop="priceCurrency" content="EUR" /></p>
</article>

There is no property for specifying the address of the offered apartment. Offer only allows for giving the address/place where you can obtain the offer (availableAtOrFrom). You could just use the PostalAddress type, but as there is no appropriate property to link it to Offer, there would be no machine-readable connection between the offer and the address.

Additionally, you might want to use

  • businessFunction → BusinessFunction for specifying that it’s about renting,
  • category for specifying that it’s about an apartment (i.e., Residence),
  • etc.


来源:https://stackoverflow.com/questions/24706603/html5-tags-and-microdata-for-a-list-of-apartments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!