Editing 404 page on Github pages

Posted on Sun 08 September 2013 in blog

By default Octopress doesn't include a 404 page, so on Github it's showed as follows:

404 github

Usually with a rack server it's needed to modify config.ru file to manage exceptions (this web explain this case), but in my case, I can not manage server side, so Github give us another way: they interpret a 404.html file as a default 404 page, as you can read on their documentation.

In summary, you need to create a new file at path sources/404.html and it will be used as 404. You can see how mine is in 404.html, and that's the code:

layout: default
<h1 style="text-align: center">Page not found</h1>
<p style="text-align:center">You can find other posts on <a href="/archives">Archives</a> of this blog, or directly go to <a href="/">the main page</a></p>
<img src="/images/404.png" style="max-width: 100%; margin: 0 auto; display: block" />
<small style="display:block; float:right">Credits of the image: <a href="http://refinedmobile.com/404">refinedmobile.com</a></small>