Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schema.org itemscope in body?

I'm quite new in Microdata / Schema.org, so still finding my way around. Since I understood that it is all about placing content in relations and references, is it a good (or bad) idea to put an entire web page for a company in one itemscope by adding it to the body tag? So you would get a structure like:

<body itemscope itemtype="http://schema.org/BarOrPub">
    <header>
        <img itemprop="logo" src="logo.jpg" alt="Logo" />
        <h1 itemprop="name">The Bar</h1>
    </header>
    <p>Bla bla</p>
    <table itemscope itemtype="http://schema.org/OpeningHoursSpecification">
        <tr><th itemprop="dayOfWeek">Monday</th><td itemprop="opens">17:00-02:00</td></tr>
        <tr><th itemprop="dayOfWeek">Tuesday</th><td itemprop="opens">17:00-02:00</td></tr>
        <tr><th itemprop="dayOfWeek">Wednesday</th><td itemprop="opens">17:00-02:00</td></tr>
        <tr><th itemprop="dayOfWeek">Thursday</th><td itemprop="opens">17:00-02:00</td></tr>
        <tr><th itemprop="dayOfWeek">Friday</th><td itemprop="opens">17:00-02:00</td></tr>
    </table>
    <p>Bla bla</p>
    <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <span itemprop="streetAddress">straatnaam huisnummer</span>
        <span itemprop="addressLocality">Plaats</span>
    </div>
</body>

And if this is a good idea, can I use itemtype "OpeningHoursSpecification" like I did above, or do I need to make it a child of an itemprop?

like image 575
Toine Avatar asked Mar 19 '23 22:03

Toine


1 Answers

Yes, you can use the body (or even the html) element.

It’s also allowed to add items (like OpeningHoursSpecification) as childs. But note these only have a relation to the parent item if you use a property (itemprop) to "link" them (like you did with PostalAddress by using the address property.)

So if you want to state that this is the OpeningHoursSpecification for the BarOrPub, you should use the openingHoursSpecification property:

<body itemscope itemtype="http://schema.org/BarOrPub">

  <table itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
  </table>

  <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
  </div>

</body>

(I’m not sure and did not check if your use of OpeningHoursSpecification in itself is correct, but that would be off-topic for this question anyway.)

like image 186
unor Avatar answered Apr 09 '23 20:04

unor