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

余生长醉 提交于 2019-12-16 19:31:02

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

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公益页面自动返回你的博客地址,因此无须做其他更改。

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!