How to Build a Fast Static Website With Hugo

Sailboat glides past a rocky coastline with a lighthouse under a bright blue sky.

Hugo turns text files into a complete website. There is no database and no program running on the server: what you publish are HTML files, so pages load fast, cost little to host and leave almost nothing to attack.

It is written in Go and builds hundreds of pages in a second or two. This guide follows the current version, 0.170, from November 2026. Commands changed recently, so older tutorials may not work.

Is it for you?

Hugo fitsWordPress fits better
Documentation, portfolios, technical blogsSeveral people who write from a browser
One person comfortable with text filesStores, memberships, forms
Content that changes a few times a weekChanges every hour
You want zero maintenanceYou want plugins

If the second column sounds like you, a managed WordPress with a good cache is also very fast.

1. Install Hugo

# macOS or Linux, with Homebrew
brew install hugo

# Windows
winget install Hugo.Hugo.Extended

# Ubuntu and others, with snap
sudo snap install hugo

The extended edition adds processing of Sass and WebP, and is the one most themes expect. Check it, and make sure that Git is installed too:

hugo version
git --version

You need 0.158 or later for what follows. On Windows, use PowerShell 7 or Git Bash, not the old Command Prompt.

2. Create the project

hugo new project my-site
cd my-site
git init

(Before version 0.158 the command was hugo new site.) You will see these folders:

FolderWhat goes there
contentYour pages, in Markdown
layoutsYour templates
staticFiles copied as they are: icons, PDFs
assetsCSS, JavaScript and images that Hugo processes
dataData files for lists and tables
themesThemes
hugo.tomlThe settings

3. Add a theme

Choose one at themes.gohugo.io. With the one from the official tutorial:

git submodule add https://github.com/gohugo-ananke/ananke themes/ananke
echo "theme = 'ananke'" >> hugo.toml

Look at when it was last updated and which Hugo version it asks for. An abandoned theme is the commonest cause of errors.

4. Configure

Edit hugo.toml:

baseURL = 'https://example.com/'
locale = 'en-us'
title = 'My site'
theme = 'ananke'

[pagination]
  pagerSize = 10

baseURL must be the final address, with the protocol and a slash at the end. A wrong one is why styles sometimes fail after publishing.

5. Write

hugo new content content/posts/first-post.md

The file begins with its data and continues in Markdown:

+++
date = '2026-11-24T10:00:00Z'
draft = true
title = 'First post'
tags = ['ideas']
+++

Text with **bold**, a [link](https://example.org/) and a list:

- one
- two

While draft is true it isn't published. To see drafts:

hugo server -D

Open http://localhost:1313. Each time you save, the page refreshes by itself.

Images with the page

Make a folder per post and put its images inside:

content/posts/trip/index.md
content/posts/trip/lake.jpg

That "page bundle" keeps everything together, and lets Hugo resize the image when it builds the site.

6. Change the design

Don't touch the theme's files. Hugo looks first in your layouts folder, so copy there only what you want to change, with the same path.

Since version 0.146 the main names are these:

FileWhat it draws
layouts/baseof.htmlThe skeleton of every page
layouts/home.htmlThe front page
layouts/page.htmlOne page or post
layouts/section.htmlThe list of a section
layouts/_partials/Pieces: header, footer
layouts/_shortcodes/Tags to use inside the text

A minimal page template:

{{ define "main" }}
<article>
  <h1>{{ .Title }}</h1>
  <time>{{ .Date.Format "January 2, 2006" }}</time>
  {{ .Content }}
</article>
{{ end }}

That odd date isn't a mistake: in Go, formats are written with that reference day.

A shortcode of your own

Save this as layouts/_shortcodes/note.html:

<div class="note">{{ .Inner | markdownify }}</div>

And use it in the text:

{{< note >}}Remember to **save**.{{< /note >}}

7. Build

hugo --minify

The finished site is in the public folder. Open a few pages and check the links before you upload it.

8. Publish

Since they are only files, you have many options:

  • Services that build from Git, such as Phluit AirLift: you start a deploy in the portal and it builds the site from your repository and publishes it, with HTTPS and your own domain. Pin the Hugo version in the build (for example in a Dockerfile) so it matches yours.
  • Your own server. Upload public with rsync to any web server, for instance on a VM:
rsync -avz --delete public/ user@example.com:/var/www/my-site/

Then point the domain and turn on HTTPS.

What a static site lacks, and how to add it

  • Contact form: an online service; see our comparison of form builders.
  • Search: Pagefind, which makes an index of the finished site.
  • Comments: giscus, based on GitHub discussions.
  • Editing from the browser: Decap CMS or similar, on top of your repository.
  • Store: payment links, or a separate store.

Common errors

  • A blank page. There are no templates: the theme's folder is empty. Run git submodule update --init.
  • The post doesn't appear. It is a draft, or its date is in the future.
  • Styles fail when published. Check baseURL.
  • "Found no layout file". Your version and the theme's don't match, or the template has its old name.

Frequently asked questions

Is Hugo better than Astro or Eleventy?

Hugo is the fastest to build and a single program with no dependencies. Astro is more comfortable for interactive parts, if you know JavaScript.

Can I move my WordPress to Hugo?

Yes, for content: plugins export posts to Markdown. Forms, comments and store stay out, and the old addresses need redirects.

Do I need to know Go?

No. Templates use its syntax, and ten expressions are enough for most sites.

Related Articles

How to Send Transactional Email from WordPress: SMTP Setup Guide WordPress

How to Send Transactional Email from WordPress: SMTP Setup Guide

Set up SMTP in WordPress to send transactional email reliably. This guide covers plugins, settings, and testing so your password resets and receipts always arrive.

Updated Dec 3, 2026
WordPress Accessibility: EAA & WCAG 2.2 Checklist WordPress

WordPress Accessibility: EAA & WCAG 2.2 Checklist

WordPress accessibility checklist for the EAA and WCAG 2.2: fix contrast, keyboard, forms and checkout issues. Start auditing your site today.

Updated Dec 3, 2026
WooCommerce Black Friday Checklist for 2026 WordPress

WooCommerce Black Friday Checklist for 2026

WooCommerce Black Friday checklist: prep hosting, speed, checkout and security before the 2026 rush. Get your store sale-ready today.

Updated Dec 3, 2026