--- title: 添加404页面 # 隐藏的模块 hide: # - navigation # 隐藏左边导航 # - toc #隐藏右边导航 # - footer #隐藏翻页 # - feedback #隐藏反馈 tags: - Mkdocs comments: false #评论,默认不开启 --- ![](https://s1.imagehub.cc/images/2024/02/02/b94cdf67258487f737cfa29829629157.png) 首先在mkdocs.yml文件中添加custom_dir: ``` hl_lines="3" theme: name: material custom_dir: docs/overrides #覆写路径 ``` docs/overrides文件下新建404.html 树状结构如下: ``` hl_lines="11" $ tree -a . ├── .github │ ├── .DS_Store │ └── workflows │ └── PublishMySite.yml ├── docs │ └── index.md │ └──overrides │ └──assets │ └──404.html │ └──main.html │ └──partials │ └──comments.html │ └── mkdocs.yml ``` ## 404公益页面 ??? note "点击展开" ```html 404 - 页面不存在``` 404 您访问的页面搞丢了
404!您要访问的页面走丢了!

404 NOT Found

您访问的页面走丢在寻找梦想的路上了

不过您还可以和腾讯志愿者一起

为孩子们点亮一个梦想
``` ## 404骰子页面 目前更换了新的404页面: ??? note "点击展开" ```html 404
4
0
4
0
4
0
4
0
4
0
4
0
4
0
4
0
4
0
4
0
```