超简单,比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,如下:

Layout Destination
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

Build Your Hexo Blog (On Github)的更多相关文章

  1. Build Your Jekyll Blog (On Github)

    http://kevinjmh.github.io/web/2014/04/20/build-your-jekyll-blog/ 20 April 2014 On GitHub Follow the ...

  2. Hexo 博客 github.io MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  3. 基于Hexo且在GitHub上搭建博客

    title: 基于Hexo且在GitHub上搭建博客 Welcome to Fofade's Blog! 搭建初衷 大大小小,大学两年,玩了很多,也学了很多. 回首望之,曾经不知道的,现在是知道了,但 ...

  4. 用nodejs安装hexo,将hexo部署到github

    跌跌撞撞写这篇博文,希望下一篇可以好点 运行环境:最新版本的nodejs + git 安装好nodejs 和 git ,注册好github账号,新建仓库****.github.io(****为gith ...

  5. hexo部署到github时,提示typeError [ERR_INVALID_ARG_TYPE] The “mode“ argument must be integer. Receive

    hexo部署到github时,提示typeError [ERR_INVALID_ARG_TYPE]: The "mode" argument must be integer. Re ...

  6. Use Hexo to Build My Gitee Blog

      之前有自己建站托管自己的博客系统, 后来因为流量实在太少, 服务器又要每个月出钱, 然后就把她关了, 然是拥有自己的网站的心一直没有退去啊, 然后之前有接触到别人用GitHub托管静态网页的玩法, ...

  7. Insert Pictures In Hexo Blog

    After build my blog following the online course step by step , I began to try to write my own blog️ ...

  8. 基于Hexo+Node.js+github+coding搭建个人博客——基础篇

    附上个人教程:http://www.ookamiantd.top/2017/build-blog-hexo-base/ 搭建此博客的动机以及好处在此就不多谈了,之前已经表达过,详情请看Start My ...

  9. 搭建 Hexo Blog

    一.教程参考:https://xuanwo.org/2015/03/26/hexo-intor/ 二.命令总结 1.node -v.npm -v:查看 node.js 是否安装成功 2.npm ins ...

随机推荐

  1. BZOJ 4590 [Shoi2015]自动刷题机 ——二分答案

    二分答案水题. #include <cstdio> #include <cstring> #include <iostream> #include <algo ...

  2. 使用docker-maven-plugin插件构建docker镜像(已过时)

    可以参考博客:https://blog.csdn.net/aixiaoyang168/article/details/77453974 docker-maven-plugin官网推荐在新项目中使用do ...

  3. PowerDesigner数据模型(CDM—PDM—SQL脚本的转换流程)

    原文地址:PowerDesigner数据模型(CDM-PDM-SQL脚本的转换流程)作者:zzenglish 有图片的参考http://blog.sina.com.cn/s/blog_64742675 ...

  4. pat 甲级 1009. Product of Polynomials (25)

    1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...

  5. pat 甲级 1056. Mice and Rice (25)

    1056. Mice and Rice (25) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Mice an ...

  6. 【BZOJ1874】取石子游戏(SG函数)

    题意:小H和小Z正在玩一个取石子游戏. 取石子游戏的规则是这样的,每个人每次可以从一堆石子中取出若干个石子, 每次取石子的个数有限制,谁不能取石子时就会输掉游戏. 小H先进行操作, 他想问你他是否有必 ...

  7. js动态添加select菜单 联动菜单

    原文发布时间为:2009-11-14 -- 来源于本人的百度文章 [由搬家工具导入] <html> <head> <title>http://hi.baidu.co ...

  8. div模拟dropdownlist控件 div下拉菜单

    原文发布时间为:2009-10-16 -- 来源于本人的百度文章 [由搬家工具导入] 控件发布:div2dropdownlist(div模拟dropdownlist控件) div3dropdownli ...

  9. About chrysanthemum and matrimony vine

    红枣.枸杞茶:可经常喝. 菊花茶.枸杞茶:适当,一般建议喝3天停3天会比较妥当. 湿热重的人不宜食红枣,可只泡枸杞.菊花或将红枣改为红茶,也能起到明目.养肝.益血.抗疲劳的功效.红枣要去核,才不会太燥 ...

  10. 数据库一直显示"正在恢复"

    restore database [DataBase] with recovery ALTER DATABASE DataBase SET OFFLINE WITH ROLLBACK IMMEDIAT ...