Setting Up a Static Blog with Hugo and GitHub Pages

This guide walks through creating a fast, modern static blog using Hugo and hosting it for free on GitHub Pages—no server management required.

Prerequisites

On Windows:

  • Install Git: Download from git-scm.com. During installation, select "Add Git to PATH" to avoid manual environment configuration.
  • Install Hugo: Get latest extended version (required for SCSS/Sass support) from Hugo's GitHub releases. Choose the .zip archive, extract it, and place the hugo.exe binary in a permanent directory (e.g., C:\tools\hugo).
  • Configure PATH: Add both Git’s bin folder (e.g., C:\Program Files\Git\bin) and your Hugo directory to the system PATH variable via System Properties → Environment Variables. Verify in a new terminal:
git --version
hugo version

Create Your Site

Open PowerShell or Command Prompt (no admin rights needed) and run:

mkdir D:\sites && cd D:\sites
hugo new site quickstart-blog --format=md --force

This creates a new Hugo project named quickstart-blog with Markdown-based content files.

Add a Theme

Browse Hugo Themes, pick one (e.g., Terminal), then initialize it as a Git submodule for easier updates:

cd quickstart-blog
git init
git submodule add https://github.com/panr/hugo-theme-terminal.git themes/terminal

Enable the theme by editing config.toml:

theme = "terminal"
baseURL = "https://your-username.github.io/"
languageCode = "en-us"
title = "My Hugo Blog"

Write and Preview Content

Create your first post:

hugo new posts/getting-started.md

That generates content/posts/getting-started.md with front matter. Edit it in VS Code or any editor. Set draft: false to publish it.

Start the local development server:

hugo server -t terminal --buildDrafts --disableFastRender

Visit http://localhost:1313 to preview changes live.

Deploy to GitHub Pages

1. Create a new GitHub repository named your-username.github.io (replace your-username with your actual GitHub handle).
2. Generate static files:

hugo -t terminal -d public --baseURL="https://your-username.github.io/"

3. Publish the public folder as its own Git repo:

cd public
git init
git add .
git commit -m "Initial site build"
git branch -M main
git remote add origin https://github.com/your-username/your-username.github.io.git
git push -u origin main

Your site is now live at https://your-username.github.io. Future updates? Just re-run hugo -d public, then commit and push the public folder again—or automate it with GitHub Actions.

Tags: hugo github-pages static-site-generation

Posted on Wed, 27 May 2026 22:00:33 +0000 by simun