What's Hugo?
Hugo is a popular open-source static site generator. After my painful journey on trying Hexo and Jekyll, Hugo makes me happy.
Get Started
Install Hugo on Mac OS.
|
|
Initialize the first website.
|
|
Set Github repo
I'm using two repos for my blog: one stores all source files of hugo and the other stores generated websites.
First, create a repo for source files in Github.
For example, my source repo is github.com/HaoboGu/source-haobogu.github.io.
After the repo for source files is created, set local hugo folder to track the repo.
|
|
Add a theme
Hugo doesn't have a built-in theme, so I decided to use hugo-nuo(my edited version). You can choose one from themes.gohugo.io/.
|
|
Add first page
|
|
You may notice that there is a generated header in the markdown file. This header is called front matter. By default, this page will not be publised because draft = true
option in front matter template.
Test your site locally
Run
|
|
Then navigate to your site at http://localhost:1313/.
Deploy site to Github Pages
Create your Github Pages repo for hosting generated site.
Suppose the site repo is github.com/HaoboGu/haobogu.github.io
, then run
|
|
Create script deploy.sh, then run this script to deploy the website
|
|
DONE!