publish-blog
Hexo 搭建博客
准备工作
- git 2.12.0
- node -6.9.3
- npm 3.10.10
下载hexo
|
|
如果执行上面的代码报错:
|
|
则执行下面的代码
|
|
在需要放博客的文件夹执行
|
|
新版本的hexo,会将blog目录放在
cd /Users/blog
npm install
hexo generate //生成博客目录 也可以用缩写 hexo g
hexo server //启动服务器,端口4000,缩写 hexo s
hexo: 3.2.2
hexo-cli: 1.0.2
os: Darwin 16.4.0 darwin x64
http_parser: 2.7.0
node: 6.9.3
v8: 5.1.281.89
uv: 1.9.1
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 57.1
modules: 48
openssl: 1.0.2j
$ git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant
$ npm install hexo-renderer-jade --save
$ npm install hexo-renderer-sass --save
$ hexo g // hexo generate的缩写
$ hexo s // hexo server的缩写
1234567891011
2. 在localhost:4000可以看效果了### 文档书写### git page部署1. npm install hexo-deployer-git --save2. vi _config.yml3. 修改deploy的值,记得一定要加Message,如果message加的有问题也不会deploy成功;
# Deployment
Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: git@github.com:FionaFromChina/FionaFromChina.github.io.git
branch: master
message: baiyang
```
- hexo deploy
部署常见问题
更改主题后首页错乱
更改主题后发现首页样式引用的css文件不对,首先要更改_config.yml的theme字段,改成自己换成的新主题,然后url写成gitio的地址,根目录是/。然后再generate并deploy.
配置错误
yml配置文件里面冒号: 后面需要添加空格,如果有配置错误,请检查是否正确添加了空格。
参考链接
https://linghucong.js.org/2016/04/15/2016-04-15-hexo-github-pages-blog/