justin․searls․co

Better 404 design

There are exactly three things I want from a 404 page:

  1. Something approaching an apology
  2. An easy way to report the broken link
  3. Copy that might elicit a sensible chuckle

This page only took a few minutes to make. The "let us know" link pre-populates the entire e-mail and is implemented in a Rails view thanks to a helper method that makes constructing mail_to links a little nicer:

def mail_to_url(email, **options)
  "mailto:#{email}?" + options.map { |k, v|
    "#{k}=#{ERB::Util.url_encode(v)}"
  }.join("&")
end
<%= link_to "let us know", mail_to_url("support@betterwithbecky.com",
  subject: "I got a 404!",
  body: "I clicked a link that led me here, but got a 404 message:\n\n#{request.url}"
) %>

Wish people spent more time sweating details like this.


Got a taste for hot, fresh takes?

Then you're in luck, because you can subscribe to this site via RSS or Mastodon! And if that ain't enough, then sign up for my newsletter and I'll send you a usually-pretty-good essay once a month. I also have a solo podcast, because of course I do.