Hugo is one of the most popular open-source static site generators, known for its speed and simple deployment. This guide walks you through building and publishing your first Hugo site.
Installing Hugo#
The installation method depends on your operating system:
- macOS:
brew install hugo - Ubuntu / Debian:
sudo apt install hugo - Windows: use Chocolatey or Scoop:
choco install hugo - Other platforms: download the corresponding binary from the Hugo Releases page
Verify the installation:
hugo versionCreating a new site#
Use hugo new site to quickly scaffold a site skeleton:
hugo new site quickstart
cd quickstartThis generates the standard directory structure: content/, layouts/, static/, and more.
Adding a theme#
A Hugo site needs a theme to render pages. Take Hextra as an example:
git init
git submodule add https://github.com/imfing/hextra.git themes/hextraThen declare the theme in hugo.toml:
theme = 'hextra'Writing your first post#
Use hugo new to create a post, with front matter in TOML format:
hugo new posts/my-first-post.mdThe front matter contains metadata such as date and title, while the body is written in Markdown, supporting code blocks, tables, images, and more:
+++
date = '2026-08-14T17:55:41+08:00'
draft = false
title = 'My First Post'
+++
## Introduction
This is **bold** text and this is *italic* text.Local preview#
Start the development server and Hugo will auto-refresh the page on file changes:
hugo server -DOpen http://localhost:1313 in your browser for a live preview.
Building and deploying#
Before publishing, generate the static files:
hugoThe output goes to the public/ directory by default; host it on GitHub Pages, Netlify, or Vercel to go live.
Summary#
| Step | Command |
|---|---|
| Create site | hugo new site quickstart |
| Add theme | git submodule add <theme-url> |
| New post | hugo new posts/xxx.md |
| Local preview | hugo server -D |
| Build & deploy | hugo |
The Hugo ecosystem is mature and the community is active. Whether it is a personal blog or a documentation site, Hugo is a trustworthy choice. Try it out now!

