Disclaimer: This post is not very interesting. Don’t say I didn’t warn you.
With the above in mind: it’s not every day that I (or as far as I know, anyone else) find a visible bug in one of Google’s core products, so I thought I’d share this one with you. You may well have spotted it already.
I’m sure you’ve followed a link to Google’s cache of a page and noticed that when you do so, it highlights the words on the page that match your original search query.
In the image above, I searched ‘bronco’ and clicked on the ‘Cached’ link, leading me to a page where Google combine a copy of the page as they downloaded it with a smaller disclaimer and add some highlighting code. Note the title of the tab in the image, Google leaves the original <title> tag from the cached page untouched, so it ends up as the window or tab title; this is despite the fact that the word “Bronco” in the title was the original query. I feel pretty confident in assuming that’s intentional.
So what’s the bug?
It seems to me that if any of the words Google highlight in the cached page appear after the thirteenth word of the <title> tag, the code that highlights the matches in the page erroneously attempts to highlight them in the page title by inserting HTML <b> tags in there. This causes the page title displayed by a browser to look like crap, frankly. An easy way to reproduce it is to search for a blog post with a long title. Like the cached page at the top for this query:
Check out that lovely title tag. Why does that happen? I have no idea. It doesn’t happen for the first few words in the title, only the later ones. I’m pretty sure the magic number is thirteen. Bizarre.
TL;DR: If you end up on a Google cache page from a search query that mentions a word that appears after the twelfth word in the cached title tag, Google try to highlight that part of the title tag and fail miserably.