zoukankan      html  css  js  c++  java
  • Build Your Hexo Blog (On Github)

    超简单,比jekyll好多了!

    看个Demo

    http://kevinjmh.github.io/ 

    了解Hexo

    Hexo是一个由Node.js驱动的,简单、快速、强大的Blog框架。可以快速的生成静态网页托管在GitHub、BAE等平台上。对Markdown有很好的支持,并支持从Wordpress、Octopress迁移。

    A fast, simple & powerful blog framework,powered by Node.js.

    Windows下安装

    ①Git : GitHub Windows 、  http://www.git-scm.com/ 或利用eclipse内置的git

    配置用户

    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"

    ② Node.JS

    ③Hexo

    在cmd命令行输入:

    • npm install hexo-cli -g

    建博客

     hexo init <folder>

     cd <folder>

     npm install

    新版以下插件:EJS, Stylus, Marked not built-in anymore要手动安装

    npm install hexo-renderer-ejs --save
    npm install hexo-renderer-stylus --save
    npm install hexo-renderer-marked --save

    运行网站

    现在命令行要在<folder>目录下,继续执行以下命令,成功后可登录http://localhost:4000/查看效果

    hexo generate 或 hexo g
    hexo server 或 hexo s

    写博

    http://hexo.io/docs/writing.html

    hexo new "My New Post"

    上面的命令生成的文章在source/_posts里面。我们可以在scaffolds里面设置生成新博客的模板 

    文章有两种layout,如下:

    LayoutDestination
    post(Default) source/_posts
    page source

    post用来放文章,page可以用来放一些比如“关于我”,“友情链接”,“404页面”之类的页面。GitHub Pages 自定义404页面非常容易,直接在根目录下创建自己的404.html就可以。但是自定义404页面仅对绑定顶级域名的项目才起作用,GitHub默认分配的二级域名是不起作用的,使用hexo server在本机调试也是不起作用的。

    目前有如下几个公益404接入地址:

    腾讯公益的只需要在source目录添加404.html文件即可,文件内容为:

    layout: false
    ---
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>宝贝,公益404带你们回家</title>
    </head>
    <body>
        <script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8"></script>
    </body>
    </html>

    一定要设置layout:false(还有三个短横线),不然会被hexo解析。

    写完之后,可以用hexo generate生成静态文件,然后用hexo server运行本地服务器,查看效果

    部署静态网页到GitHub

    首先安装模块 npm install hexo-deployer-git --save

    然后执行hexo g命令生成public文件夹

    再执行 hexo d 会自动commit。

    当然,也可以把生成的内容全部拷贝到<同步的git目录>手动上传

    绑定域名

    你可以在free domains域名免费注册里选择自己喜欢的域名

    申请成功之后,添加两条域名解析A记录指向github pages

     **.tk. 192.30.252.153 

     **.tk. 192.30.252.154

    或者

    添加域名解析CNAME到你的网址**.github.io.

    然后在自己的博客仓库根目录新建名为CANME的文件,里面内容为你的域名地址。

    Hexo简写命令

    hexo n #new
    hexo g #generate
    hexo s #server
    hexo d #deploy

    http://hexo.io/docs/commands.html 

    主题

    pacman 

    jacman 

    Reference:

    http://ibruce.info/2013/11/22/hexo-your-blog/

    http://wsgzao.github.io/post/hexo-guide/

    官方文档 http://hexo.io/docs/

    https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

  • 相关阅读:
    magento head.phtml 加载<a target=_parent
    火狐浏览器七个黑客必备工具插件
    Windows 2003】利用域&&组策略自动部署软件
    js zhi网马
    js 判断网页类型
    zencart hosts本地解析
    优化之zencart第一时间修改原始内容
    realypay
    mysql 配置
    1.4-动态路由协议OSPF③
  • 原文地址:https://www.cnblogs.com/manhua/p/4236391.html
Copyright © 2011-2022 走看看