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 fits | WordPress fits better |
|---|---|
| Documentation, portfolios, technical blogs | Several people who write from a browser |
| One person comfortable with text files | Stores, memberships, forms |
| Content that changes a few times a week | Changes every hour |
| You want zero maintenance | You 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 hugoThe 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 --versionYou 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:
| Folder | What goes there |
|---|---|
content | Your pages, in Markdown |
layouts | Your templates |
static | Files copied as they are: icons, PDFs |
assets | CSS, JavaScript and images that Hugo processes |
data | Data files for lists and tables |
themes | Themes |
hugo.toml | The 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.tomlLook 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 = 10baseURL 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.mdThe 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
- twoWhile draft is true it isn't published. To see drafts:
hugo server -DOpen 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.jpgThat "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:
| File | What it draws |
|---|---|
layouts/baseof.html | The skeleton of every page |
layouts/home.html | The front page |
layouts/page.html | One page or post |
layouts/section.html | The 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 --minifyThe 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
publicwith 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.
