JimmyLiao

JimmyLiao blog: coffee, running, thinking

Move to Hexo

2016-05-05 Hexo Blog Markdown

A new start for blogging…

  1. Follow this
$ sudo npm install --unsafe-perm --verbose -g hexo
$ mkdir hexo
$ cd hexo
$ hexo init
$ npm install hexo --no-optional
$ npm install  

$ hexo g #完整是hexo generate 生成靜態頁面
$ hexo s #完整是hexo server 運行本地服務器

裝git發布插件,運行:

$ npm install hexo-deployer-git --save

安裝完成後在Hexo根目錄通過_config.yml對相關參數進行設置,在最後幾行:

deploy:
  type: git
  repo: git@github.com/abc/abc.github.io.git #這裏是你剛獲取的地址
branch: master
$ vim ~/.ssh/config
host abc.github.com
 HostName github.com
 IdentityFile ~/.ssh/github_rsa
 User git 

保存設置,撰寫新文章,然後生成頁面,最後發布頁面:

$ hexo new [layout] <title>
$ hexo g
$ hexo d #完整是hexo deploy 發布到遠程服務器

或是生成頁面和發布頁面用一條命令:

$ hexo d -g

P.S. have to hexo clean before hexo g

$ hexo clean
$ hexo g
$ hexo d
  1. Follow this instruction to setup local env.

Update: Following steps are for anther laptop

$ git clone your hexo repo (source branch)
$ npm install hexo --save #reinstall if new env does not have hexo cli
$ npm install hexo-deployer-git --save
$ hexo init
$ git clone https://github.com/iissnan/hexo-theme-next themes/next
$ hexo g
$ hexo d
comments powered by Disqus