HEXO specifies 404 page
Since Hexo is hosted on github, adding a 404 page is very easy. You only need to create a new 404 page under xxx.github.io. The code is as follows:
<p class="sycode"> 1 </p> <p class="sycode"> 2 </p> <p class="sycode"> 3 </p> <p class="sycode"> 4 </p> <p class="sycode"> 5 </p> <p class="sycode"> 6 </p> <p class="sycode"> 7 </p> <p class="sycode"> 8 </p> <p class="sycode"> 9 </p> <p class="sycode"> 10 </p> Copy after login | <p class="sycode"> <!DOCTYPE html> </p> <p class="sycode"> <html lang="en"> </p> <p class="sycode"> <head> </p> <p class="sycode"> <meta charset="UTF-8"> </p> <p class="sycode"> <title>404 </title> </p> <p class="sycode"> </head> </p> <p class="sycode"> <body> </p> <p class="sycode"> 自定义 </p> <p class="sycode"> </body> </p> <p class="sycode"> </html> </p> Copy after login |
We can also use Tencent’s public welfare 404 page
and just copy the javascript code in the page into our code
<p class="sycode"> 1 </p> <p class="sycode"> 2 </p> <p class="sycode"> 3 </p> <p class="sycode"> 4 </p> <p class="sycode"> 5 </p> <p class="sycode"> 6 </p> <p class="sycode"> 7 </p> <p class="sycode"> 8 </p> <p class="sycode"> 9 </p> <p class="sycode"> 10 </p> Copy after login | <p class="sycode"> <!DOCTYPE html> </p> <p class="sycode"> <html lang="en"> </p> <p class="sycode"> <head>]\ </p> <p class="sycode"> </p> <p class="sycode"> <meta charset="UTF-8"> </p> <p class="sycode"> <title>404 </title> </p> <p class="sycode"> </head> </p> <p class="sycode"> <body> </p> <p class="sycode"> <script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8"> </script> </p> <p class="sycode"> </body> </p> <p class="sycode"> </html> </p> Copy after login |
as shown below :
At this time you will find that when you deploy hexo again, the 404 page on github has been deleted again. This is because your hexo does not have this file in your local folder, so it will be gone as soon as it is synchronized. Even if you add it in the local root directory, hexo will delete it.
Therefore, this 404 page should be placed under the source directory. (Note, do not put it in the post under source)
Files placed under source will be uploaded but will not be parsed into the article. The source directory structure is as follows
This You're done
Enter a non-existent domain name and you will see the results