搭建过程
以下均摘录自知乎
## 准备工作
注意 本文主要针对Windows
平台和Hexo 3.x
### 了解Hexo
>A fast, simple & powerful blog framework
Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。
http://hexo.io**
### 安装GIT
[GitHub Windows](GitHub for Windows**)
简单可依赖,安装完成后依据提示操作即可,So Easy
###安装Node.JS
Node.JS
注意 安装完成后添加Path环境变量,使npm
命令生效
``` bash
C:\Program Files\nodejs\node_modules\npm
```
### 安装Hexo
配置好GitHub
家目录后,双击桌面上的Git Shell
,输入npm
命令即可安装
``` bash
npm install -g hexo-cli
npm install hexo –save
```
-–
## Hexo初始化配置
### 创建Hexo文件夹
安装完成后,根据自己喜好建立目录(如E:\kuaipan\GitHub\hexo
),进入Git Shell
切换到该路径下E:\kuaipan\GitHub\hexo
执行以下指令
``` npm
hexo init
```
### 安装Hexo插件
``` bash
npm install hexo-generator-index –save
npm install hexo-generator-archive –save
npm install hexo-generator-category –save
npm install hexo-generator-tag –save
npm install hexo-server –save
npm install hexo-deployer-git –save
npm install hexo-deployer-heroku –save
npm install hexo-deployer-rsync –save
npm install hexo-deployer-openshift –save
npm install hexo-renderer-marked@0.2 –save
npm install hexo-renderer-stylus@0.2 –save
npm install hexo-generator-feed@1 –save
npm install hexo-generator-sitemap@1 –save
```
### 本地查看效果
继续执行以下命令,成功后可登录localhost:4000
查看效果
``` bash
hexo server
```
### Hexo简写命令
``` bash
hexo n #new
hexo g #generate
hexo s #server
```
-–
## 部署静态网页到GitHub
### 注册设置GitHub
- 登录[GitHub](GitHub · Build software better, together.**),注册自定义用户名如
wsgzao
- 在主页右下角创建
New repository
,name必须和用户名一致如[http://wsgzao.github.io**](https://link.zhihu.com/?target=http%3A//wsgzao.github.io)
- 首次创建耐心等待10分钟左右审核,之后即可访问静态主页如HelloDog**
### 同步内容至GitHub
- 下载[GitHub Windows](GitHub for Windows**)
- 设置
Local path
如E:\快盘\GitHub\
- 运行
Git Shell
切换到如E:\快盘\GitHub\hexo
路径下 - 执行
hexo g
命令生成public
文件夹 - 把生成的内容全部拷贝到
Local path
或其子目录 - 运行
GitHub
确认修改信息后执行右上角的Sync
同步 - 最后访问主页观察效果
[GitHub Pages**](GitHub Pages**)
-–
## 域名和DNS
### 域名推荐
> GoDaddy makes registering Domain Names fast, simple, and affordable.
【推荐理由】两个字“靠谱”,支持支付宝,附优惠码链接
[Domain Names**](Domain Names**)
[Godaddy Coupon Code**](Godaddy Coupon Code**)
### DNS推荐
>致力于为您提供最稳定、最安全的域名解析服务
【推荐理由】依然是两个字“靠谱”,感谢他们一直以来对于公益的坚持
### 设置CNAME
- 在Github的网站目录下创建
CNAME
文件 - 填写自己的域名如
[http://hellodog.com**](https://link.zhihu.com/?target=http%3A//hellodog.com)
,保存结束 - 登录DNSPod,先添加域名,然后添加记录,设置如下