Hexo博客如何添加404公益页面

1.在博客主页面菜单添加公益选项

以maupassant主题为例,编辑maupassant主题文件下的_config.yml

vim Blog/themes/maupassant_config.yml

编辑效果如下

menu:
  - page: home
    directory: .
    icon: fa-home
  - page: archive
    directory: archives/
    icon: fa-archive       
  - page: about
    directory: about/
    icon: fa-user
  - page: 公益
    directory: 404
    icon: fa-heart

公益页面的位置随意填写不存在的目录地址即可;无须使用命令hexo new page创建公益页面的真实文件夹。

2.创建404.html

  • 在博客根目录sourec文件夹下建立404.html
vim Blog/source/404.html

如果选择腾讯的404公益页面添加内容如下:

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8;"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="robots" content="all" />
  <meta name="robots" content="index,follow"/>
</head>
<body>
<script type="text/javascript" src="//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js" charset="utf-8" homePageUrl="http://lilibei.net" homePageName="回到我的主页"></script>
</body>
</html>

注意:homePageUrl="your web site"处填写你的博客地址,如http://lilibei.net

如果选择益云404公益页面添加内容如下:

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8;"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="robots" content="all" />
  <meta name="robots" content="index,follow"/>
</head>
<body>
<iframe scrolling='no' frameborder='0' src='http://yibo.iyiyun.com/Home/Distribute/ad404/key/1355117' width='654' height='470' style='display:block;'></iframe>
</body>
</html>

益云404公益页面自动返回你的博客地址,因此无须做其他更改。

最终效果如下,当然也欢迎访问我的博客查看。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容