Hugo Tutorial

Homepage generated by Hugo

Download Hugo

Follow instructions on Hugo.

Verify Hugo

hugo version

Create a new site

hugo new site mypage

Download a theme

cd mypage
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke

Try template

We can find an example in exampleSite, where static stores images and content stores markdown files.

cp -r ./themes/hugo-coder/exampleSite/* ./

Deploy page on local server

hugo server -D

See it with localhost:1313 on your browser.

Deploy page on GitHub

Build a repository named ${username}.github.io and build static page configuration. Follow instructions here.

hugo -D

The folder public generated with command above is what we should commit to github.

cd public
git init
git remote add origin https://github.com/${username}/${username}.github.io.git
git add .
git commit -m "Initial commit"

If there are existed files in repository such as README, conduct pull request first.

git pull origin master

Push commit. Add -u when pushing for the first time.

git push -u origin master