Steps
- Go to your blog folder, and create a new page named 404. Hexo will generate a subfolder named 404 under the folder source. Inside subfolder 404 contains a markdown file named index.
File structure: source > 404 > index.md
1 | cd MyBlog |
- Edit index.md with the information you want to display on your 404 error page. Also, edit the front-matter area.
Defining permalink for the error page
1 | permalink: /404.html |
Hide the date of this page
1 | no_date: true |
Hide the comment area of this page
1 | no_comments: true |
Hide the about/copyrights area of this page
1 | no_about: true |
index.md
1 | --- |
- Generate static files by using hexo generate.
1 | hexo g |
This will generate a subfolder 404 with an index.html
file.
- If you host your website on a cloud server, modify your Nginx config.
1 | #ERROR-PAGE-START |
Example link: https://jinchuan.site/404
Reference
About this Post
This post is written by Andy, licensed under CC BY-NC 4.0.