2

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>
2
  • Have you checked schema.org already? For a start maybe look at schema.org/Residence
    – CBroe
    Jul 11, 2014 at 21:16
  • Yes I did, but this is the first time for me using microdata and it seems that I'd need a mix of Product and Residence.
    – StockBreak
    Jul 11, 2014 at 21:22

1 Answer 1

6

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

6
  • Very clear and thorough answer, thanks! About the tags I used, are they correct?
    – StockBreak
    Jul 12, 2014 at 15:41
  • 1
    @StockBreak: Yes, your use of HTML5 seems to be appropriate: the outline is correct, no misuse of elements. (Note that the chosen HTML5 elements, with a few exceptions, don’t matter for Microdata consumers; but there are of course plenty other reasons why correct/semantic markup is important.)
    – unor
    Jul 14, 2014 at 13:24
  • I searched around for a while but I couldn't find a concrete example about using businessFunction. Do I really have to use <link /> elements? Would you please provice one to me? I have 2 types: Renting and Selling. I really appreciate your help unor!
    – StockBreak
    Jul 18, 2014 at 21:41
  • 1
    @StockBreak: You could also use an a element, but it probably doesn’t make sense to have this as a visible link, so link is typically used (as it is hidden by default). See Martin Hepp’s answer to a question about BusinessFunction.
    – unor
    Jul 18, 2014 at 23:09
  • suppose that I would like to add a <p> element under <p>My location</p> with the function (e.g. <p>For rent</p> or <p>Sell</p>), how would I describe it? You can also edit your answer and add it if you want. Thanks!
    – StockBreak
    Jul 20, 2014 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.