Protecting Against Link Rot While Embracing the Future

In this week’s issue of A List Apart, Val Head wrote about animations and how they can improve user experience. Val provided some demos, and we had to decide how to feature them.

We prefer to host demos on our own servers, a practice that guards against link rot. Link rot occurs when a site re-organizes their URL scheme but doesn’t re-direct visitors from old URLs to new ones, or when a site ceases to exist (Dean Allen where are you), or when pages are simply taken down (for reasons passing understanding).

In this case Val provided her demos via CodePen, one of the better code-sharing tools available. CodePen makes it easy to download the shared files, but it seemed a shame to host the demos locally and not take advantage of the features CodePen offers. So, cool, let’s embed the pen, right?

But wait

If we’re thinking about the future (or more helpfully, the past), we have to consider: What happens when CodePen goes away? Or changes its URL structure? Or puts limits on the number of times a pen can be viewed? None of these things seem likely today, but on a long enough timeline the survival rate for everything drops to zero (and we’ve seen a lot of link rot since 1998).

We’re conflicted between wanting fun (and helpful) toys, and being good caretakers of content; it’s something of an existential crisis.


There’s an answer.

My own knee-jerk argument was that updating broken demos wouldn’t be an onerous task; as long as we’re careful to save demos locally we can easily swap them in. But if we’re anticipating a future where embedded pens aren’t working, who’s to say I’ll be around and will have passed on the knowledge on how to fix them?

If cool URLs don’t change, cool content anticipates un-cool URLs.

Here’s what to do

1. Save the code locally

We have a space on our server where all demos live. (That it happens to be in the folder that’s distributed to our CDN is a bonus.)

2. Alter the embed code

Here’s the standard embed code for a pen:

See the Pen Show/Hide Example by Val Head (@valhead) on CodePen.

CodePen’s embed code, like Twitter’s and like our own embeddable comments, includes a snippet of HTML meant for when the embed script fails and the embedded content doesn’t render. This could happen for a couple reasons:

  1. JavaScript is failing, or turned off, in which case the reader probably isn’t going to benefit from CodePen’s features anyway, or
  2. CodePen’s servers aren’t responding, and the embed code isn’t going to work at all.

So, let’s change the embed code to take advantage of this built-in fail-safe and use it to make our content future friendly:

See the demo: Show/hide example

And it works

Turn off JavaScript and re-visit Val’s article. Instead of the embedded demos you’ll see some nice-looking links.

(It’s worth noting that while I’m not necessarily endorsing CodePen over other embeddable code-sharing tools (Gists, jsFiddle, etc.) I am recommending it as a future-friendly tool for the simple reason that it has the HTML fallback snippet. Embeds that don’t have a fallback can fail invisibly, leaving holes that may or may not be evident.)

So, if CodePen goes away? The embedded demos automatically become links to our local versions. It’s a bit more work, but 100% worth it.

  • By The fine folks at A List Apart
  • Posted in Uncategorized
  • Tagged Dean Allen, HTML, URL, Val Head
  • Translator

  • Recent Articles

    • HTC One M8 on Verizon Android 4.4.4 update appears
    • 27″ iMac w/ 5K Display Now Available for Pre-Order at B&H
    • Study Finds 40% Of Adults Have Experienced Online Harassment
    • Watch PK First Official Trailer, Aamir Khan’s new movie
    • Goodwell’s Smart Toothbrush Seeks Crowdfunding To Become A Reality
    • Scarlett Johansson getting $10 million for Suicide Squad: Reports
    • Secure Messaging App Telegram Adds Usernames And Snapchat-Like Hold-To-View For Media
    • iOS 8.1 reviews for iPhone 5 and 5S
    • Apple To Build 25 More Apple Stores In China
    • SensoTRACK Wearable Fitness Tracker And Health Monitoring Smart Earpiece (video)
    • Once Upon an Alphabet: Oliver Jeffers’s Imaginative Illustrated Stories for the Letters
    • B&O Play A2 Bluetooth Speaker Announced
    • 5 Ways to Get Web Traffic That Converts
    • The Most Overlooked Aspects of Disaster Recovery Plans: How to Avoid Unintentional Gaps
    • Naked Pics of Celebrities: What’s Not Safe in the Cloud?
    • 10 of the World’s Most Amazing Gorges
    • New $50 Kinect Adapter Enables Xbox One Kinect To Work With Windows 8.1
    • LG L5 Dual and F60 price listings for India and specs
    • HTC One M8 Eye Is Not Coming To Europe
    • Xbox One Screenshot Support Not Arriving Until Next Year