超简单,比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. BZOJ4540 [Hnoi2016]序列 【莫队 + ST表 + 单调栈】

    题目 给定长度为n的序列:a1,a2,-,an,记为a[1:n].类似地,a[l:r](1≤l≤r≤N)是指序列:al,al+1,-,ar- 1,ar.若1≤l≤s≤t≤r≤n,则称a[s:t]是a[ ...

  2. 几种API接口

    实用号码归属地查询(IP 地址,手机号码): 默认格式: http://api.liqwei.com/location/ (使用来访者的 IP 地址) 指定 IP 地址格式: http://api.l ...

  3. vue经验总结

    1. vue中获取dom节点时机 vue组件中获取dom节点一定要在mounted周期之后的下一次事件循环,包括 component.$refs,component.$el,component.$ch ...

  4. Databus架构分析与初步实践

    简介 Databus是一个低延迟.可靠的.支持事务的.保持一致性的数据变更抓取系统.由LinkedIn于2013年开源.Databus通过挖掘数据库日志的方式,将数据库变更实时.可靠的从数据库拉取出来 ...

  5. 【HDOJ5975】Aninteresting game(BIT原理)

    题意:给定n个区间,第i个区间的范围是[i-lowbit(i)+1,i].一共有q组询问,询问有两种: 1 x y:询问sigma lowbit(i) (x<=i<=y) 2.x:询问有几 ...

  6. [LeetCode] Factorial Trailing Zeroes 阶乘末尾0

    Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...

  7. js链式调用 柯里化

    var d = 1; d.add(2).add(3).add(4) //输出10 写出这个add函数 Number.prototype.add = function(x){ return this + ...

  8. EasyUI左边树菜单和datagrid分页

    //这个页面是Home.html 1 <!DOCTYPE html> <html> <head> <meta http-equiv="Content ...

  9. 将Map<String, List<Map<String,Object>>>进行排序

    首先我贴上我的代码,刚开始我也不知道怎么排序还写了一些方法,最后请教群里的大神解决了 public Map<String, List<Map<String,Object>> ...

  10. 机器学习3_EM算法与混合高斯模型

    ①EM算法: http://www.cnblogs.com/jerrylead/archive/2011/04/06/2006936.html 李航 <统计学习方法>9.1节 ②混合高斯模 ...