Tuesday, September 25, 2012

Customizing your 404 - Page Not Found

Earlier this year Blogger made it possible for its publishers to customize its "404 - Not Found" page, the page someone sees when going to non-existent address. Today we look at donating it as space for a PSA (Public Service Announcement)..

Some people choose to customize their 404 page with ads, and that’s perfectly fine. I don’t use ads, so my 404 page used to look like rather bland and utilitarian:

BlogIdol-404
<h2>Sorry, the page you're looking for is not in (holiday?)</h2> <p>Sorry, we cannot find the page that you are looking for. It might have been removed, had its name changed, or is temporarily unavailable.<br/> Please check that the Web site address is spelled correctly. </p> <b>Other things to try:</b><br/> <ul> <li>Use the blog search field at the top to search for articles or the one below.</li> <li>You may browse by keywords / labels / categories. You will find them in the cloud on the right.</li> <li>At the end of each article you will find a number of predefined searches or "Tags." Clicking them will display all the articles containing that word.</li> <li>If a video does not show up, it may be because YouTube has changed the embed codes for Playlists. You can still see it by clicking "yt-" link in Sources, which will take you straight to the playlist page on Youtube. <li>If you know the approximate time when the article was published, you might want to search for it in the chronological archive, accessible in sidebar under "Archives."</li> <li>Go to our <a href="/">home page</a>, and use the menus or links to navigate to a specific post.</li> <li>If you have further questions, please read the FAQ (click the menu link at the top). <li> <form method="get" action="/search"> <table width="100%"> <tr> <td><input type="text" style="width:95%;padding:2px;" value="Search this blog.." onfocus="if (this.value == &quot;Search this blog..&quot;) {this.value = &quot;&quot;}" onblur="if (this.value == &quot;&quot;) {this.value = &quot;Search this blog...&quot;;}" name="q"></td> <td><input type="button" Value="Search"></td> </tr> </table> </form> </li> </ul>

A service I recently learned about allows you to display an updating picture of missing children on your 404 / Not Found page:

According to tnw,

NotFound was cooked up by Brussels-based advertising agency Famous (via Lev Detrez).

Strangely, rather than having a piece of code that anyone could just copy and paste, the website requries registration. We did register and obtained the following:

<iframe height="650" src=http://notfound-static.fwebservices.be/404/index.html?&key=aa9b09a0f9fd4f44386be6ebfbf6e9b5 frameborder="0" width="100%"></iframe>

Looking at the code, it seems that the key is tied into the registration. You should probably obtain your own registration by going to the site’s process (link below, in Sources). We pasted the code above on top of our 404 page.

Just in case you want a different more personal 404 / Not Found webpage, there’s more tricks you can use. On Blogger, you may do the following:

  • To change the Page Title, add the following right under <head> in your template:

    <b:if cond='data:blog.pageType == &quot;error_page&quot;'>

    2
    <title>You've ripped a hole in the fabric of the internet. </title>

    3
    </b:if>

  • To reset the styling, add the following to your template:
    <b:if cond='data:blog.pageType == "error_page"'>
    <style type="text/css">
    .status-msg-wrap {
    font-size: 100%;
    margin: none;
    position: static;
    width: 100%;
    }
    .status-msg-border {
    display:none
    }
    .status-msg-body {
    padding: none;
    position: static;
    text-align: inherit;
    width: 100%;
    z-index: auto;
    }
    .status-msg-wrap a {
    padding: none;
    text-decoration: inherit;
    }
    </style>
    </b:if>

  • To provide your visitor with an option to search your blog, use
    <form method="get" action="/search"> <table width="100%"> <tr> <td><input type="text" style="width:95%;padding:2px;" value="Search this blog.." onfocus="if (this.value == &quot;Search this blog..&quot;) {this.value = &quot;&quot;}" onblur="if (this.value == &quot;&quot;) {this.value = &quot;Search this blog...&quot;;}" name="q"></td> <td><input type="button" Value="Search"></td> </tr> </table> </form>
  • You may also use any of the following general hacks.

One nifty trick is to use one image as a page background, with the following code:



<style type="text/css" >

2
body {background:white url('imageURL')  50% 0% no-repeat !important;z-index:10000000;}

3
.sidebar, footer, .content, .header, .columns-inner, .footer-top {display:none;}

4
body {min-width: 0px !important;}

5
</style>


Replace “imageURL” with any of the following after making sure they work (hover with your mouse to read a quick description):



  1. https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDofX0DDRcxnFFhdQfllNZKkkwrG8Hy3nb3zNqm9PxD4iKR6sSKf1lKOvIbn8DreXoSQrjvPm2LEaQKnWlnDDdluKFUjwHDx2X5IB1LrluOyN5AJAQJx_6O6S87rhOuwE99dzdiT3dtVk/s1600/1.PNG
  2. http://2.bp.blogspot.com/-aG5cP8p7o_I/T3SaTkT36QI/AAAAAAAADeI/FsbF3e4lXQE/s1600/2.PNG
  3. http://3.bp.blogspot.com/-5SFkmqRvMCQ/T3Sakx8oobI/AAAAAAAADfk/PcjuCFlSvAY/s1600/3.PNG
  4. http://4.bp.blogspot.com/-C45nv_Rafm0/T3SamEZ33fI/AAAAAAAADfs/bS-YASblcsE/s1600/4.PNG
  5. http://4.bp.blogspot.com/-SjkdED58HNo/T3Sang2RskI/AAAAAAAADf0/7bOWMEAKAzM/s1600/5.PNG
  6. http://4.bp.blogspot.com/-02kltH_9-8A/T3SarNv5ElI/AAAAAAAADf8/GKvqoJRE4eI/s1600/6.PNG
  7. http://2.bp.blogspot.com/-SFZa-holDjU/T3SasNpz5PI/AAAAAAAADgA/0AqrEmktztE/s1600/7.PNG
  8. http://1.bp.blogspot.com/-5zSjs_PzXv0/T3SatH6lGVI/AAAAAAAADgM/ztXZIrKY6ts/s1600/8.jpg
  9. http://2.bp.blogspot.com/-2n6J8shby9c/T3Say_IFqhI/AAAAAAAADgU/CfW5qT4kVhI/s1600/9.PNG
  10. http://4.bp.blogspot.com/-ODAyD5JasIA/T3SaBjtBZWI/AAAAAAAADc4/Z0OOdsACbT4/s1600/10.PNG
  11. http://2.bp.blogspot.com/-rJdUa4NqEvA/T3SaDCQQX-I/AAAAAAAADdA/x35P0XCtFkI/s1600/11.PNG
  12. http://4.bp.blogspot.com/-fPGVCfi8juo/T3SaIXELC0I/AAAAAAAADdI/njTxaVQ3hv8/s1600/12.PNG
  13. http://4.bp.blogspot.com/-lWH_CidqS7A/T3SaJkTrOVI/AAAAAAAADdQ/hNAkSej5_-s/s1600/13.gif
  14. http://3.bp.blogspot.com/-cBZsmnOiWrM/T3SaK9z5-2I/AAAAAAAADdY/VT1doL7Q9KQ/s1600/14.PNG
  15. http://2.bp.blogspot.com/-07Tq8gL0Qgg/T3SaL-nTBHI/AAAAAAAADdg/0RIDg5kQ_oQ/s1600/15.gif
  16. http://2.bp.blogspot.com/-jJ_26UAIJsI/T3SaNVg7l5I/AAAAAAAADdo/a7LQr38En4k/s1600/16.PNG
  17. http://3.bp.blogspot.com/-mZH84IbeRdc/T3SaPNAzhmI/AAAAAAAADdw/5aDvRWsJfIQ/s1600/17.PNG
  18. http://1.bp.blogspot.com/-1eg_JUXi1hA/T3SaQg0RyRI/AAAAAAAADd4/x7AgXB12BJI/s1600/18.PNG
  19. http://3.bp.blogspot.com/-i1gm2JH5pfk/T3SaRzLgykI/AAAAAAAADeA/F-U_YeWDmJc/s1600/19.png
  20. http://2.bp.blogspot.com/-Cf38etYZ9-I/T3SaVJXBsvI/AAAAAAAADeQ/MMbaJpempbM/s1600/20.PNG
  21. http://1.bp.blogspot.com/-h-R-k3VGcLE/T3SaV6UL7DI/AAAAAAAADeY/NTYP95fJZDU/s1600/21.PNG
  22. http://1.bp.blogspot.com/-Si0YZCegSWg/T3SaX900-cI/AAAAAAAADeg/eGKOFvulIe0/s1600/22.PNG
  23. http://1.bp.blogspot.com/-cU-M8yYyW48/T3SaZl-1aUI/AAAAAAAADeo/7Fuyvx7ztAM/s1600/23.PNG
  24. http://3.bp.blogspot.com/-1dmKRFghyls/T3SabCVdXdI/AAAAAAAADew/9tV9HhaYZqE/s1600/24.jpg
  25. http://2.bp.blogspot.com/-oA6TapIsrEA/T3SacXb-FLI/AAAAAAAADe4/JVlE-FDyDUs/s1600/25.jpg
  26. http://3.bp.blogspot.com/-0v1buyDHaPc/T3Sadfx2XxI/AAAAAAAADfA/oG5JgqHAR4k/s1600/26.PNG
  27. http://1.bp.blogspot.com/-u8iG_6AXIog/T3SafeUWkpI/AAAAAAAADfI/8grWqQsa4nM/s1600/27.PNG
  28. http://3.bp.blogspot.com/-26DYJtSeX4w/T3Sagk5hVBI/AAAAAAAADfQ/CoHwgFeDfl4/s1600/28.PNG
  29. http://3.bp.blogspot.com/-kAuUGv-ql9c/T3SaipcQb8I/AAAAAAAADfY/TxeGEXv1h64/s1600/29.PNG
  30. https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1oZ8HQyDdR_5_zdWXSrONdcNddx4rg0yP_cNPexlXRG5_i53Yd80t_1-KX-ZTRnFUr-eaa8t7Rv42F1Hti7L_o09G4OqziiADdzvUE76hZMUBzwEFqBX6RPFUZnQADq3B46kB6OsGappq/s1600/404.jpg

Note, however, that some of these may actually be subject to copyright (see the link we provided below for inspiration).


Finally, you might want to use Google missing page search code, which will populate the search field with the keywords that led to the missing page:



<script type="text/javascript">
  var GOOG_FIXURL_LANG = 'en-GB';
  var GOOG_FIXURL_SITE = 'http://3w.blogidol.ro’
</script>
<script type="text/javascript"
  src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js">
</script>


Make sure you replace 3w.blogidol.ro with your own.doma.in. Don’t forget that nothing prevents you from making your own using hk-404 as inspiration. Keep in mind though that other sites use 404 as a automatic redirect to their homepage.


Sources / More info: notfound.org, tnw, bp-404, syb-404



No comments:

Post a Comment

Thank you for commenting and rest assured that any and all comments are welcome, whether positive or negative, constructive or distructive. Unfortunately, if you comment in this view I might not know about - please use the regular (Desktop) view.
I am using Disqus for commenting, but Blogger is not showing it so your comments may end up not being displayed - tell Google about it!