问题
I'm building a website for a small store and want to implement schema.org-microdata-markup. The "problem": The store is opened from Tuesday till Friday – from 10:00 till 14:00 AND from 16:30 till 23:00 on these days. So I implemented the opening hours like this…
<time itemprop="openingHours" datetime="Tu-Fr 10:00-14:00, 16:00-23:00">XYZ</time>
But this way, the HTML-validator says…
Bad value Tu-Fr 10:00-14:00, 16:00-23:00 for attribute datetime on element time: The literal did not satisfy the time-datetime format.
How can I implement these multiple opening hours a day? Or is it impossible to do this with the <time>
-tag and I have to change it to <meta>
-tags? Thanks for your help! :-)
回答1:
The problem is the notations schema.org uses for openingHours are just not (yet) valid by the HTML5 spec for the time element.
You can copy all the examples from LocalBusiness in the Validator and they will all fail validation.
Until the spec contains a definition to write openingHours in a time element you will have to ignore the HTML validators I'm afraid.
BTW. The text on the schema.org site implies you could defines multiple times in one value:
The opening hours for a business. Opening hours can be specified as a weekly time range, starting with days, then times per day.
回答2:
What if you used 2 entries for openingHours?
<time itemprop="openingHours" datetime="Tu-Fr 10:00-14:00">XYZ</time>
<time itemprop="openingHours" datetime="Tu-Fr 16:00-23:00">XYZ</time>
回答3:
The LocalBusiness example has been updated to use <meta>
elements:
<div itemscope itemtype="http://schema.org/Restaurant">
<span itemprop="name">GreatFood</span>
...
Hours:
<meta itemprop="openingHours" content="Mo-Sa 11:00-14:30">Mon-Sat 11am - 2:30pm
<meta itemprop="openingHours" content="Mo-Th 17:00-21:30">Mon-Thu 5pm - 9:30pm
<meta itemprop="openingHours" content="Fr-Sa 17:00-22:00">Fri-Sat 5pm - 10:00pm
</div>
回答4:
I recently ran in to the same issue and found that the second string of hours needs to be on another line like this:
<p><time itemprop="openingHours" datetime="Mo,Tu,We,Th, 08:30-13:30">M-Th 8:30am-12:30pm & 1:30pm-6:00pm</time>
<time itemprop="openingHours" datetime="Mo,Tu,We,Th, 14:30-18:00"></time></p>
It's also important to keep this code inside the closing tag, otherwise it will not register as being formatted correctly.
来源:https://stackoverflow.com/questions/14926650/schema-org-multiple-opening-hours-on-same-day