Since Google recently added +1 Metrics to Webmaster Tools and Social Engagement to Google Analytics, I decided to add the Google +1 button to my website. All went well until I ran my site through the W3C’s HTML validator. The new button caused my previously valid site not to validate.
While of course, it’s not the end of the world I kept getting the following validation error:
“Element name g:plusone cannot be represented as XML 1.0.”
The code that Google gave me seemed to be the issue.
So of course, I started searching to see if anyone else was having the same problem. I wasn’t able to find much, so I decided to check out Google’s documentation to see if I could find any info.
Apparently, using the default code snippet Google provides in combination with the HTML5 Doctype will cause the validation error.
In the documentation Google provides an HTML5-valid syntax alternative which is available as follows:
<div class="g-plusone" data-size="small" data-count="true"></div>
Needless to say, I switched out the code and voilÃ problem solved. My site is now valid again and all is well in the universe. Nice looking out Google!