由于板瓦工升级,之前的wordpress弃坑,转hexo+github方案
一 安装node.js
- 安装node
| 1 | brew link node | 
- 验证node
| 1 | npm -v | 
- 卸载node
| 1 | brew uninstall node | 
二 配置ssh免密登陆
- 配置免密登陆
| 1 | github->setting->SSH And GPG keys->New SSH Key | 
- 验证配置成功
| 1 | ssh -T git@github.com | 
输入yes
显示:
| 1 | Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts. | 
三 安装hexo,部署项目
- 安装hexo
| 1 | npm install -g hexo-cli | 
- 创建项目
| 1 | hexo init <folder> | 
- 本地部署
| 1 | hexo generate | 
- 部署到github
| 1 | vim _config.yml | 
进入文件最后部分
| 1 | deploy: | 
部署:
| 1 | hexo g | 
若执行hexo g出错则执行npm install hexo --save,若执行hexo d出错则执行npm install hexo-deployer-git --save。错误修正后再次执行hexo g和hexo d上传到服务器。
- 更换next主题,进入到项目根目录
| 1 | git clone https://github.com/iissnan/hexo-theme-next themes/next | 
四 绑定域名
- github端
在项目主题中source文件夹中创建CNAME文件,没有后缀名,然后将个人域名huanghanqing.com添加进CNAME文件即可,然后通过hexo g hexo d重新部署网站。
- 域名解析
登陆域名解析商:https://www.dnspod.cn/console/dns/huanghanqing.com
- 记录类型:CNAME
- 主机记录:@
- 解析线路:默认
- 记录值:qingzhouzhen.github.io
重新建一个记录,因为我之前指向了板瓦工端ip,这里指向了CNAME,把之前存在的cname记录删掉重新建一个
next 主题设置
文章只显示预览,themes->next->_config.yml
| 1 | # Automatically Excerpt. Not recommand. | 
false改为true
参考: