Gawker Learns the Hard Way Why ‘Hash-Bang’ URLs are Evil

URLs are an often overlooked part of web design, yet in many ways they may be the most important aspect of your website as Gawker’s family of sites recently discovered.

Gawker recently launched a multi-site redesign that, no sooner than being unleashed on the web, failed spectacularly, leading visitors to blank pages. The culprit was a misbehaving piece of JavaScript, but when a single line of JavaScript causes your entire suite of sites to fail you no longer have websites, you have, well, nothing.

The problem with Gawker’s redesign is that it uses JavaScript to load everything. That means that, not only is there no chance for the site to degrade gracefully in browsers that don’t have JavaScript enabled, the smallest JavaScript typo can crash the entire website.

Developer Mike Davies has a nice breakdown of why Gawker’s JavaScript-based hash-bang URLs are a bad idea. Originally designed to allow Google’s spider to crawl Ajax content, hash-bang URLs have been popping up all over the web — Twitter and Facebook use them as well — but that doesn’t make them a good idea.

As Davies writes:

the #! URL syntax was especially geared for sites that got the fundamental web development best practices horribly wrong, and gave them a lifeline to getting their content seen by Googlebot.

And today, this emergency rescue package seems to be regarded as the One True Way of web development by engineers from Facebook, Twitter, and now Lifehacker.

The problem in Gawker’s case is that the URLs no longer point to actual content, everything depends on JavaScript parsing the hash-bang to retrieve the content. As Davies writes, “if content cannot be retrieved from a server given its URL, then that site is broken.” Think of hash-bang URLs as a worst practice of URL design.

If you’d prefer not to hang your site’s fate on the most brittle part of the open web stack — JavaScript — make sure you have a publishing system that allows you to design your own URLs and then follow the established best practices for creating good URLs.

If you’ve got Ajax content that would otherwise be missed by Google, then by all means use the hash-bang syntax, just keep in mind that the hash-bang is basically a hack, not the cornerstone of a well designed URL.

Eat at URLs photo by Scott Schiller/Flickr/CC.

See Also: