Hom's Blog


Github Jekyll自定义404页面(MD方式)

Custom 404 Pages with Jekyll markdown style


  • It’s very easy. Just create a file named 404.md or 404.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="/" to window.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

  1. Custom 404 Pages
  2. Create a custom Jekyll 404 page

本博文已合并到Github相关总结中, 不再更新.



◆ 本文地址: http://platinhom.github.io/2015/07/09/404Page-Jekyll/, 转载请注明 ◆

前一篇: Project Page in Github Page
后一篇: JS不支持缺省参数


Contact: Hom / 已阅读()
Source 类别: IT  标签: Git  Website