W3C’s HTML validator throwing up an HTML error with Schema.org markup?
As part of our SEO work, it has been important for businesses to include Schema.org -Structured data markup to help search engines understand their content and serve their site as a high ranking and relevant search for business related search terms and keywords.
It is also fairly important to ensure your site validates and conforms to HTML standards – although it is always important to code for the human first, and an HTML error warning isn’t necessarily a bad thing, if you understand the error and the reason for coding that way outweighs the benefit of a 100% validating website.
For a number of years now Schema have suggested a certain format for business opening hours – now the structured data around opening times is pretty crucial and a very important thing for a business to accurately convey.
For the past year or so there has been a conflict with HTML 5 validation and the previous recommended method by Schema.
The literal did not satisfy the time-datetime format – Error
Now the old Schema recommendation for a store open 9-5, 5 days a week was:
<time itemprop="openingHours" datetime="Mo-Fr 09:00-19:00">Monday-Friday: 9:00 am to 7:00 pm</time>
This would throw up an error when using the HTML validator. For the previous year we have ignored this error in favour of the bonus of correct structured data mark-up. Well the good news this year Schema have updated their recomendations for correctly displaying this information, and by following the below edit you will once again have validating HTML and accurate structured data!
The solution to solve the time-datetime format error
Replace “time” with “span” and “datetime” with “content” – below shows how you should now structure the same opening hours to comply with the new Schema and once again have validating HTML.
<span itemprop="openingHours" content="Mo-Fr 09:00-19:00">Monday-Friday: 9:00 am to 7:00 pm</span>
This can also be read in full here with the Schema.org opening hours information page.