Hugo + Github Pages

Install Hugo

Install hugo following the instruction of the linked document is a piece of cake. Homebrew is a fantastic tool for mac users. After installation, Hugo new site myblog will generate a project called myblog for you. Things in /myblog is the source code of your blog.

Choose a Theme

Actually, I don’t feel those themes on Hugo official website are of good look. Some of them are not really easy to use because of their poor ducumentation. Hope you can find what you want, or maybe customize a theme for yourself.

Host on Github

  • This step is not hard but might drive you crazy when you first do this following the instruction on Github .

  • For this step, two repos are needed (This seemes a little bit strange, but trust me, this is the easiest way to handle and the simplest method to understand.)

  • one is to hold our source code of blog

    • create an empty repo called ‘myblog-hugo’ on your github
    • git clone //myblog-hugo-url//
    • move all files your generate in /myblog into this cloned direction
    • rm -rf public
      • we will add public as a submodule of this repo, so that we can handle these two repos seperately.
  • the other is used to hold the /public which can be generated every time you run Hugo server on your own computer.

    • create a new empty repo called ‘your-name.github.io’
    • NOTICE: ‘your-name’ should be your github account
    • just like kksun.github.io
    • in /myblog-hugo direction
      • git submodule add git@github.com:your-name/your-name.github.io.git public
      • copy this file deploy.sh into /myblog-hugo as well.
  • Remember to give permission to run this script. This script can publish any change you that you make about your blog with one click.

    • chmod +x deploy.sh
    • ./deploy.sh

references:

Tags// ,
More Reading
Newer// About me
comments powered by Disqus