How to set up a personal site using hexo and github

It’s the first to set up a personal site, so note this down for future reminder, just for fun.

Configure

  • install Node.js and NPM by brew install node, then check it by node -v and npm -v
  • install hexo CLI now by npm install -g hexo-cli
  • since we are to locate the site in github then we have to create a new repo
  • install several basic plugins npm install hexo-deployer-git --save, npm install hexo-generator-category --save, npm install hexo-generator-tag --save to enable git, categories and tags
  • hexo init repo-name to initialize

Test

Nothing special just refer to hexo documenation.

  • testing locally first can ease lots of burden hexo new draft "My-First-Blog-Post"
  • edit it vim /source/_drafts/My-First-Blog-Post.md

    1
    2
    3
    4
    5
    6
    ---
    title: My First Blog Post
    tags:
    ---
    ## Hello there
    This is some content.
  • then start it locally hexo server --draft --open

  • make the draft a real post hexo publish My-First-Blog-Post
  • generate and deploy hexo generate --deploy
  • how to add custom domain

reference:
https://www.cgmartin.com/2016/01/03/getting-started-with-hexo-blog/
http://www.jianshu.com/p/fd878edb95e7

Theme

using ~next~ check this.