Saturday, September 17, 2011

Google breadcrumbs - itemscope must be first attribute

I want nice breadcrumbs to show on my Google search results as defined here:

http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=185417

My web framework must use well formed XML templates so instead of the itemscope attribute (a boolean attribute which is not valid xml) I used itemscope="itemscope"

The handy Rich Snippets Testing Tool showed that my breadcrumbs were not being picked up.  After a frustrating process of elimination I realised that the itemscope attribute must be the first attribute in the element or Google will not recognise it.  Thats not very XML friendly but probably a good performance optimisation.