• GitHub Pages allow to host static content directly from repository on GitHub. More about GitHub Pages you can find in documentation

  • Hugo is a static website generetor written in Go. More about Hugo you can find in documentation


To host Hugo webpage on GitHub Pages I prepared 3 repositories:

Here was my steps:

1. Create empty Hugo site in blog folder.

cd blog
hugo new site . --force

2. Add theme repository as submodule

git submodule add$GITHUB_PROFILE/hugo-theme-m10c.git themes/m10c

I use submodule, because I can make changes in theme and have history of that in my repository.

3. Add theme reference

Open config.toml and add this line

theme = "m10c"

4. Run local site server

hugo server

Now site is empty and need some configuration.

5. Site configuration

Here is my config.toml file after configuration:

baseURL = ""
languageCode = "en-us"
title = "Bartosz Pelikan"
theme = "m10c"

  author = "Bartosz Pelikan"
  description = "Cloud Technology Enthusiast | .NET developer"
  avatar = "/images/img.jpg"

  name = "github"
  url = ""

  name = "twitter"
  url = ""

  name = "linkedin"
  url = ""

  name = "mysite"
  url = ""

6. Add first post

Add file to /content/posts/2020.

title: 'Hello World!'
date: '2020-06-20'

First post

7. Publish site

Now it’s time to publish site to GitHub Pages. GitHub doesn’t support Hugo site generator, just Jekyll, but fortunately it’s possible to achieve this by sending static files.


This command will generate static files in /publish folder.

But before run above command let’s create in /publish folder submodule that will be GitHub repository hosting our site.

git submodule add$YOUR_GITHUB_PROFILE/$YOUR_GITHUB_REPO.git public

I created script that will help me to publish site:

find public -type f -not -name 'CNAME' -not -name '' -not -name '.git' -delete
cd public
git status
git add .
git commit -m "Publish site $(date +"%Y-%m-%d %H:%M:%S")"
git push origin master

All what I need to do now is run sript: