Better 404 design
There are exactly three things I want from a 404 page:
- Something approaching an apology
- An easy way to report the broken link
- 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.