Generate the whole site with posts using Hugo, store the site sources in a private GitHub repository, and host the generated site on Netlify.

Hugo → GitHub → Netlify diagram

The diagram above shows the overall blog setup and the complete publishing workflow:

  • creating a new post locally as a Markdown file
  • adding and committing it to the local Git repository
  • pushing the changes to GitHub
  • letting Netlify automatically build and deploy the updated Hugo site (HTML and assets)

Setup

I followed the official Hugo guides:

Result: a Git repository with a Hugo site project and the following directory structure:

tree -L 1
.
├── archetypes
├── assets
├── content # contains posts and site pages
├── data
├── hugo.toml
├── i18n
├── layouts
├── netlify.toml # contains hosting configuration, e.g. build command (here: `hugo`), site URL
├── public # contains the generated site (HTML and assets) created by the `hugo` command
├── static
└── themes

I store this repository as a private repository on GitHub. The repository is connected to a Netlify project.

On every commit to the production branch, Netlify automatically:

  • runs hugo to generate the static site (rebuilding the public directory)
  • deploys and hosts the newly generated public directory

Create a post

I create a new Markdown post file under the content/posts directory using the hugo new command:

hugo new content/posts/hugo-github-netlify-setup-and-workflow.md
cat content/posts/hugo-github-netlify-setup-and-workflow.md
+++
date = '2025-12-04T20:00:00+01:00'
draft = true
title = 'Hugo Github Netlify Setup and Workflow'
+++

Preview a post locally

I can generate and preview the whole site including posts locally in a web browser using Hugo’s local web server:

hugo server -D
...
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)

Deploy a post

If everything looks good, I add the post Markdown file to the Git repo, commit it, and push it to the production branch:

git add content/posts/hugo-github-netlify-setup-and-workflow.md
git commit -m "Add Hugo, GitHub, Netlify blog setup and workflow post"
git push

Netlify automatically starts a build (running hugo to generate fresh HTML and assets) and deploys the result.
The updated site is published instantly.