
I've been messing about with Blogger templates over the last few days and I've spotted that Blogger seem to have broken the HTML of every blog they host! They have added an invalid element within the
head
section of each page which causes the premature closing of the head
section. Depending on what scripts etc. you use in your template this may cause a problem.The new code that Blogger have added to our templates is aimed at adding extra metadata to each page, which in turn will enable Google to have more information about each page within a blog when they are included in a search result. They are using the schema.org metadata format to achieve this. Specifically each page of this blog now contains the following in the
head
section:1 2 3 | < meta content = 'Code from an English Coffee Drinker' itemprop = 'name' /> </ itemscopetag > |
The problem is that they have used an
itemscopetag
tag, which isn't valid in any version of the HTML specification. Also the specification tells us that if, when parsing the head
section of a page we encounter an unknown tag "act as if an end tag token with the tag name "head" had been seen, and reprocess the current token". This essentially causes the premature closing of the head
section, with anything else now part of the body
instead. Depending on what has been forced out of head
and into body
and which browser you are using you may see different results. For example, it looks as if links to the Chrome Web Store are broken by this.What Blogger should have done was added the information to the
body
tag or one of the main content div
tags instead. For example, they could have started the body
as follows:1 2 | < meta content = 'Code from an English Coffee Drinker' itemprop = 'name' /> |
Unfortunately there doesn't appear to be anyway to remove this code from our blogs. The best we can do is to move the piece of template code that generates the invalid tag (as well as lots of other code) as late in the
head
section as possible, so that it pushes the least possible code into the body
. To do this you need to edit the HTML version of your template and move the line:1 | < b:include data = 'blog' name = 'all-head-content' /> |
head
tag so it looks like:1 2 | < b:include data = 'blog' name = 'all-head-content' /> </ head > |
I can't pretend that I fully understood the mechanics but I think I got the gist of the affect. You'd think an organisation as big as Google could get that right.
ReplyDelete