Hugo, GitHub, VPS (1): A Work Flow for static sites

· Tech

I changed my username (See About) on Twitter and GitHub recently. Then, my updates to the blog won’t be examined by GitHub Pages. Worse is better, maybe it’s a chance for me to migrate the site on my DigitalOcean VPS. However, I still want to manage my source code on GitHub, tracing the change log and not necessary to worry about data loss.

The tasked is divided into three sections:

  1. Listen to the changes (Git Push) on GitHub.
  2. Pull new changes from GitHub to VPS.
  3. Generate the site from source codes.

For step 3, since my blog has to be generated by Jekyll and the repository on GitHub is just source code, the VPS has to execute jekyll build command after receiving git updates. But I met with some problems here due to Ruby and Jekyll. Again, worse is better. I thought about Hugo, which is a much faster generator written in Go. So I replaced Jekyll and refactored my blog, but it’s a painful process because it’s unfriendly to implement some logic with Hugo. Regardless, the blog you are reading is made by Hugo now.

In the next article, I will write about how to build a hook program on the VPS with Tornado and Supervisor.