美文网首页
Hexo博客如何添加404公益页面

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

作者: 种地的pele | 来源:发表于2019-12-16 18:05 被阅读0次

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

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

    相关文章

      网友评论

          本文标题:Hexo博客如何添加404公益页面

          本文链接:https://www.haomeiwen.com/subject/awbdnctx.html