| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
8年前发布

使用Hexo建立独立博客

Hexo介绍

Hexo是一个快速、简洁且高效的博客框架。

Hexo使用 Markdown 来编写文章,通过Hexo生成静态网页,然后部署到服务器上。

安装 NodeJS

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
</div>
nvm install 4
</div>

或者到Nodejs官网直接下载安装

https://nodejs.org/en/
</div>

安装 Hexo

npm install hexo-cli -g
</div>

初始化工作

hexo init blog  cd blog  npm install  hexo server
</div>

部署到Gitcafe

创建账号

https://gitcafe.com/

创建项目

建一个跟用户名相同的项目

https://gitcafe.com/GitCafe/Help/wiki/Pages-%E7%9B%B8%E5%85%B3%E5%B8%AE%E5%8A%A9

添加ssh key

使用ssh-keygen 生成 ssh key

ssh-keygen -t rsa -C "your name"
</div>

这样默认会在本地的~/.ssh目录下生成id_rsa,id_rsa.pub两个文件,id_rsa是私钥,id_rsa.pub是公钥。

cat ~/.ssh/id_rsa.pub
</div>

把里面的内容拷贝到gitcafe的ssh keys设置中

安装部署插件

npm install hexo-deployer-git --save
</div>

配置hexo

打开_config.yml, 修改deploy模块

deploy:  - type: git    repo: git@gitcafe.com:xxxx/xxxx.git    branch: gitcafe-pages
</div>

开始部署

hexo deploy
</div>

部署成功后,通过 http://xxxx.gitcafe.io 访问你的网站

xxxx 是你gitcafe的用户名

写作命令

  • 建立新文章:hexo n “新文章名”
  • 预览文章:hexo s
  • 生成网页:hexo g
  • 发布文章:hexo d
  • 生成网页并发布文章:hexo d -g
</div>

来自: https://aswifter.com/2016/01/16/hexo-with-gitcafe/

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!