Using Gohugo With Github Pages

This is a guide to how I have my GitHub pages site configured with my GoHugo repository. To do this, you will need two repositories:

  1. The first one is your GitHub Pages personal repo. Instructions here:
  2. The second is what contains your GoHugo src files, after following the GoHugo Quickstart Guide

My respective repositories are

Setting up GitHub Pages Repo as Static File Directory

When hugo is executed, it generates the static files in the public/ directory. The easiest way to do this is to delete this directory if you have already created it. Now you can use the git submodule add command to add your GitHub Pages repo as your static folder location. Example using my pages repo

git submodule add public

Now my public static file directory is my GitHub Pages repo. When I execute hugo it will now populate that submodule with the static files, allowing me to push those changes to my public Pages branch. And the local Hugo source files can be checked into what ever branch you are storing those in.

Moving Forward

I would like to automate the GoHugo content proccess, and git versioning for posting new blog posts, gallaries, etc… So far I am fairly happy with the GoHugo static site generator from a simple setup, and the erblog theme for GoHugo. Going forward, I will be developing my own theme I’m calling noless-nomore. Just what you need, and no more for a generic Hugo site using Bootstrap.