Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I add Microdata from HTML5 to a XHTML Strict site and still be compliant?

Tags:

I've got a site coded in XHTML 1.0 Strict. I want to use the new Microdata to add breadcrumbs to my site (so Google will understand them).

My old non-microdata marked-up breadcrumbs look like this:

<ul>   <li><a href="...">Level 1</a></li>   <li><a href="...">Level 2</a></li>   <li><a href="...">Level 3</a></li> </ul> 

According to Google, to markup breadcrumbs using Microdata, you extend the above code like this:

<ul>   <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">     <a href="..." itemprop="url">       <span itemprop="title">Level 1</span>     </a>   </li>   ... </ul> 

But this is not valid XHTML 1.0 Strict.

What should I do?
Should I ignore the validation conflicts?
Should I write itemscope="itemscope" instead of just itemscope (this would be valid XML, but still not valid XHTML)?
Should I change the Doctype to be HTML5 instead of XHTML 1.0 Strict?

I want this to work all the way back to IE6!

Please advice :)

like image 364
Thomas Watson Avatar asked Sep 07 '10 14:09

Thomas Watson


People also ask

Does HTML have stricter requirements than xhtml?

XHTML is a stricter, more XML-based version of HTML.

What is xhtml compliant?

If your site is XHTML compliant, then it ensures that the Google bot and other search engine crawlers have easy access to it.


1 Answers

Yes, if you wanted to use itemscope in XHTML, you would need to write itemscope="itemscope" and use XHTML5 (same DOCTYPE as HTML5, but XML syntax).

itemscope is not included in W3 HTML5, but present in WHATWG's version, so validation may continue to be a difficulty. There seems to be quite some political argument on this issue, which I haven't been following as it looks fairly tedious.

For the moment, if you want to use breadcrumb annotations in a finalised, validatable document format, you could use RDFa instead: the alternative (but older) proposal, which the argument is all about, and use the existing doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> 
like image 130
bobince Avatar answered Oct 20 '22 17:10

bobince