Hexo介紹
Hexo是一個快速、簡潔且高效的博客框架抡医。
Hexo使用Markdown
來編寫文章擂橘,通過Hexo生成靜態(tài)網(wǎng)頁,然后部署到服務(wù)器上寞埠。
安裝 NodeJS
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
nvm install 4
或者到Nodejs官網(wǎng)直接下載安裝
https://nodejs.org/en/
安裝 Hexo
npm install hexo-cli -g
初始化工作
hexo init blog
cd blog
npm install
hexo server
部署到Gitcafe
創(chuàng)建賬號
創(chuàng)建項目
建議一個跟用戶名相同的項目
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"
ssh-keygen
生成時會詢問輸入文件名屁置,這個直接回車按默認(rèn)的來,
密碼按自己的需要設(shè)置一下仁连。
這樣默認(rèn)會在本地的~/.ssh目錄下生成id_rsa蓝角,id_rsa.pub兩個文件,
id_rsa是私鑰饭冬,id_rsa.pub是公鑰使鹅。
cat ~/.ssh/id_rsa.pub
把里面的內(nèi)容拷貝到gitcafe的ssh keys設(shè)置中
gitcafe-sshkey.jpg
安裝部署插件
npm install hexo-deployer-git --save
配置hexo
打開_config.yml, 修改deploy模塊
deploy:
- type: git
repo: git@gitcafe.com:xxxx/xxxx.git
branch: gitcafe-pages
注意: 以上冒號后面必須都要有一個空格
開始部署
hexo d -g
部署成功后,通過http://xxxx.gitcafe.io
訪問你的網(wǎng)站
xxxx
是你gitcafe的用戶名
寫作命令
- 建立新文章:hexo n "新文章名"
- 預(yù)覽文章:hexo s
- 生成網(wǎng)頁:hexo g
- 發(fā)布文章:hexo d
- 生成網(wǎng)頁并發(fā)布文章:hexo d -g