Assigning Itemscope Attribute a Value in Rich Snippet

So we are using some rich snippets and they use the html5 markup scheme.

Our problem is the itemscope attribute doesn't have a value.

<div itemscope itemtype="http://schema.org/LocalBusiness">

This cause our old products html validation to fail because it thinks it's an empty tag. Does google and markup rules work the same if you assign it a value of 1 like so.

<div itemscope="1" itemtype="http://schema.org/LocalBusiness">

It's a work around for now until we can properly update our validation methods but that is a farther out project.

So basically is there a proper syntax to make this still valid for Googles Rich Snippet rules, html5 and older validation engines prior to html5?

Answers


(This answer is basically copied from Peter Murray, specifically these two comments.)

The HTML5 spec allows for boolean attributes with a value of an empty string or the attribute name:

If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.

So either this:

<div itemscope="" itemtype="http://schema.org/LocalBusiness">

or this:

<div itemscope="itemscope" itemtype="http://schema.org/LocalBusiness">

is valid HTML5.

To be sure that Google recognizes itemscope="itemscope" correctly, he (Peter Murray) created an example page and ran it through Google's rich snippet validator. From the results, you can see that Google picked up the data (an Event item) correctly.


Need Your Help

How to move compressed image file PHP

php image-compression

Here is the function that compress image file.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.