Coding有一个Pages的服务,可以用来托管静态网页.国内访问速度比github快得多, 也可以绑定域名.
Hexo的安装和使用
环境安装
需要预先好git和node.js
全局安装hexo和hexo的运行工具
npm install hexo
npm install hexo-cli
初始化项目
这里使用blog作为项目名
hexo init blog
运行hexo
cd blog
hexo server
查看 http://localhost:4000/ 可以浏览到hexo初始化的默认主体博客
coding上创建项目
在coding的上面创建一个新项目.
Pages服务有个特点, 如果项目名和用户名一样. 就可以使用 username.coding.me访问发布的网站, 否则则是 username.coding.me/projectname
开启Pages服务
进入项目页面的'Pages服务'那一栏,立即开启. 默认使用了coding-pages的branch
绑定ssh证书
本地生成ssh证书
把证书的公钥(~/.ssh/id_rsa.pub)的内容拷贝到coding个人账户下的SSH公钥里面
配置hexo的deploy方式
在一开始hexo生成的blog目录下面找到_config.yml
在文件最低端加上deploy到coding的配置
deploy:
type: git
repo:
coding: git@git.coding.net:username/projectname.git,coding-pages
注意coding的配置是 coding:{项目git地址},{branch}
最后执行生成静态文件
hexo g
由于coding的Pages服务是默认执行jekyll项目, 静态项目需要一个.nojekyll文件标识.
所以第一次执行, 需要在生成的public文件夹中加入一个 .nojekyll 空白文件
还有部署命令
hexo d
就可以发布成功了
访问username.coding.me或者username.coding.me/projectname试试吧
后面每次更新博客的时候, 就只需要重复上面的命令hexo g && hexo d
就可以立刻发布
查看实例 http://ipro.xin
网友评论
```
$ hexo d
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
warning: LF will be replaced by CRLF in 2016/07/02/hello-world/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in archives/2016/07/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in archives/2016/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in archives/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in css/style.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-buttons.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-buttons.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-media.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-thumbs.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/helpers/jquery.fancybox-thumbs.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.pack.js.
```