Custom 404 Pages with Jekyll markdown style
- It’s very easy. Just create a file named
404.md
or404.html
on the root directory of your homepage. - Surely, we need to make it more interesting:
---
title: 404
layout: page
---
<script language="JavaScript"> function myrefresh(){window.location="/";}setTimeout('myrefresh()',5000);</script>
## Error 404. Nothing was found :(
How did you get to this link?
Please go to [homepage](/) or email me:
zhaozxcpu@hotmail.com
## The page will redirect to the homepage after 5 seconds.....
- Here, I use my template “page” layout for it, similar to my homepage.
- The javascript will refresh the 404 page after 5 second and redirect it to my homepage.
- You can change
window.location="/"
towindow.history.back()
, which could be back to the previous site. - Below it’s something you want to say~
Hey, see the result here: My 404
Ref2 Yi Zeng also told you a method to create a 404.html page and use redirection in head of html. You can read it. But I recommand my method, it’s easy and could retain you homepage style easily :)
Reference
本博文已合并到Github相关总结中, 不再更新.