Hexo 使用详解

Hexo 博客系统所需知识大概说明一下。

Github

注册 Github 账号,并新建 用户名.github.io 仓库。

Git

安装 Git
生成 SSH 公钥、密钥
公钥 复制到 GitHub

Node.js

换源

安装

1
$ npm install -g hexo-cli

初始化

1
2
3
4
$ mkdir hexo
$ hexo init <folder>
$ cd <folder>
$ npm install

配置

git

1
$ npm install hexo-deployer-git --save
1
2
3
deploy:
type: git
repo: git@github.com:khs1994/khs1994.github.io.git

你可能会配置多个仓库

1
2
3
4
5
deploy:
type: git
repo:
aliyun: git@code.aliyun.com:khs1994/www.khs1994.git,master
github: git@github.com:khs1994/khs1994.github.io.git,master

日常操作

生成静态文件

1
$ hexo g

hexo server

1
2
$ npm install hexo-server --save
$ hexo server -p 8080 #-p 指定端口

发布到 GitHub

1
2
$ hexo g
$ hexo d
0%