Introduction Link to heading

This article explains how to create a static site using hugo and host it on Github. If you don’t have a github.io repo, create one first. Check my article here for some help.

I tried jekyll mentioned on github pages documentation itself. But I found it cumbersome and didn’t want to work with a completely new (for me) tool chain to get my website going. I found hugo to be much easier and quick to get going with minimal install and setup. Their documentation is short and crisp.

Hugo Quick Start Link to heading

The instructions on Hugo here are short and self explainatory. Once you have a simple post ready you need to commit and push your work to github. Note that you can git add and commit the themes directory. This will not commit each file in that directory but just a link to the theme repo. Also, make sure that the public/ and resources/ are added to .gitignore and not commited to the repo. Long story short, only your raw content in contents/ (namely the markdown files) and the site configurations need to go to the github repo.

Github Actions Link to heading

Now that all the raw content and site config is in the repo we need to create the final product (html, javascript, etc) that will be deployed to your website.

This will be done for us by Github actions. In your repo <username>.github.io create a file .github/workflows/hugo.yaml. You can copy paste my file (https://github.com/adityanaidu/adityanaidu.github.io/blob/main/.github/workflows/hugo.yaml) into your repo. Now go to <username>.github.io > Settings > Pages > Build and deployment > Source. Change Source to GitHub Actions. Whenever a commit is pushed to the repo, this will start building and then deploying your website.