Google Groups

Re: Implementing Schema html tag attritbutes correctly


Jenny Murphy Feb 26, 2012 5:36 PM
Posted in group: Google+ Developers
Hi Logan,

You can add the itemscope attribute to any element on your page that contains all of the attributes that make up that scope. This includes the <html> element at the root of your page (since by definition it contains all of the elements on your page), but you may find it technically easier and more readable to add the itemscope further down your tree to the lowest parent of all of your microdata. 

For example, in the case of your local address information you may want to add it to the element, possibly a div, that contains all of the address info. This will result in a tighter grouping of your microdata and better match it to what your user's see. Does this make any sense?

~~Jenny


On Friday, February 24, 2012 8:49:40 PM UTC-8, Logan Sargent wrote:
I'm trying to accomplish both adding a 1+ button to my site and adding organizational microdata for company name, address, phone number, etc for Google local search.

I have all the item types & item properties set correctly in the html body for the organizational data div element. I also have the appropriate item properties in the head tag for the 1+ button snippets.

The confusing part is how to set the html tag above the head tag in my page. The 1+ setup page gives guidance to:

<!-- Update your html tag to include the itemscope and itemtype attributes -->
<html itemscope itemtype="http://schema.org/LodgingBusiness">

But in the Google forum a Contributor was saying you don't actually add the itemscope or itemtype in the html tag, but rather in the div element in the page (which I do have setup correctly). She states to add the schema.org namespace
xmlns:schema="http://schema.org/" in the html tag. Right now my html tag is displayed as: <html xmlns="http://www.w3.org/1999/xhtml">

Do I extend the html tag to read as: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:schema="http://schema.org/"> ?

Also, if my schema type if for a "LodgingBusiness", I have this itemscope itemtype set to such in the body div element. Do I also need to make it set as this in the html tag?

Thanks

On Friday, February 24, 2012 8:49:40 PM UTC-8, Logan Sargent wrote:
I'm trying to accomplish both adding a 1+ button to my site and adding organizational microdata for company name, address, phone number, etc for Google local search.

I have all the item types & item properties set correctly in the html body for the organizational data div element. I also have the appropriate item properties in the head tag for the 1+ button snippets.

The confusing part is how to set the html tag above the head tag in my page. The 1+ setup page gives guidance to:

<!-- Update your html tag to include the itemscope and itemtype attributes -->
<html itemscope itemtype="http://schema.org/LodgingBusiness">

But in the Google forum a Contributor was saying you don't actually add the itemscope or itemtype in the html tag, but rather in the div element in the page (which I do have setup correctly). She states to add the schema.org namespace
xmlns:schema="http://schema.org/" in the html tag. Right now my html tag is displayed as: <html xmlns="http://www.w3.org/1999/xhtml">

Do I extend the html tag to read as: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:schema="http://schema.org/"> ?

Also, if my schema type if for a "LodgingBusiness", I have this itemscope itemtype set to such in the body div element. Do I also need to make it set as this in the html tag?

Thanks