Hugo should be configured for reproducible static builds, theme version control, and secure deploy workflow.
Hugo uses configuration files in the site root:
| File | Format | Location |
|---|---|---|
hugo.toml |
TOML (default) | Site root |
hugo.yaml |
YAML | Site root |
hugo.json |
JSON | Site root |
Basic configuration in hugo.toml:
# Site settings
baseURL = 'https://example.com/'
languageCode = 'en-us'
title = 'My Hugo Site'
theme = 'ananke'
# Build settings
enableGitInfo = true
enableRobotsTXT = true
# Taxonomies
[taxonomies]
category = 'categories'
tag = 'tags'
# Menu configuration
[[menus.main]]
name = 'Home'
pageRef = '/'
weight = 10
[[menus.main]]
name = 'Posts'
pageRef = '/posts'
weight = 20
# Markup settings
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true # Allow raw HTML in Markdown
Content files use front matter for metadata. Example content/posts/my-post.md:
---
title: "My First Post"
date: 2026-02-11T00:00:00+00:00
draft: false
description: "Description of my post"
tags: ["hugo", "ssg"]
categories: ["blog"]
---
Content goes here...
Hugo can use environment variables:
# Set environment
HUGO_ENV=production hugo --minify
# Override config
HUGO_BASEURL=https://example.com hugo
# Development with live reload
hugo server -D
# Production build
HUGO_ENV=production hugo --minify
# Deploy to web server
rsync -avz public/ user@server:/var/www/html/
Back up:
Recovery test:
hugo to rebuildpublic/--minifySqueezing every bit of performance from your Hugo installation? Our experts help with:
Optimize your setup: office@linux-server-admin.com | Contact Us