本文介绍如何用 hexo 快速地在 gitcafe 上搭自己的个人博客。
环境准备
- 安装 Node.js
- 安装 git
- 安装 Hexo:
1
|
$ sudo npm install -g hexo
|
Hexo 官网: Hexo
本地建博客
1 2 3 4
|
hexo init blog cd blog npm install hexo server
|
hexo 命令
- 初始化新的Hexo项目: hexo init
- 创建一篇新文章: hexo new “blog’s title”
- 构建静态文件: hexo generate,简写为hexo g
- 开启本地server进行预览:hexo server, 简写为hexo s。 执行后可以访问localhost:4000进行效果预览。
- 部署到远程服务器: hexo depoly,简写为hexo d
把博客部署到 gitcafe
gitcafe 和 github 很相似,可用于代码托管,同样具有 git-pages的功能,能够托管静态网页。
- 注册gitcafe账号。在gitcafe注册并创建公开项目,项目名和用户名要一致。
在blog_config.yml添加如下代码:注意把 your_name 替换成你的项目名
1 2 3 4
|
deploy: type: github repository: git@gitcafe.com:your_name/your_name.git branch: gitcafe-pages
|
写文章
在blog 目录下,
1 2 3 4
|
hexo n "my first blog" hexo g hexo s hexo d
|
后话
博客的一些个性化设置,将在后序的博客中分享
用hexo在gitcafe上搭个人博客
原文:http://blog.csdn.net/shoulinjun/article/details/41788303