How to Set Up a Static Site with Hugo
Hugo is one of the fastest static site generators available, written in Go. It can build thousands of pages in seconds, making it perfect for blogs, documentation sites, portfolios, and landing pages. Because Hugo outputs plain HTML files, your Breeze instance serves content incredibly fast with minimal resources.
Why Choose a Static Site Generator
- Speed — pre-built HTML serves instantly without database queries
- Security — no dynamic code means a drastically reduced attack surface
- Scalability — static files handle massive traffic with ease
- Simplicity — no database, no server-side language dependencies
Step 1 — Install Hugo
Install the extended version of Hugo on your Breeze instance. The extended version includes Sass/SCSS support:
wget https://github.com/gohugoio/hugo/releases/download/v0.124.0/hugo_extended_0.124.0_linux-amd64.deb
sudo dpkg -i hugo_extended_0.124.0_linux-amd64.deb
hugo version
Alternatively, install via snap:
sudo snap install hugo --channel=extended
Step 2 — Create a New Site
hugo new site mysite
cd mysite
This creates the standard Hugo directory structure:
content/— your Markdown content fileslayouts/— HTML templatesstatic/— images, CSS, JS, and other static assetsthemes/— installed themeshugo.toml— site configuration
Step 3 — Install a Theme
Initialize a Git repository and add a theme as a submodule:
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
Set the theme in your configuration:
echo 'theme = "ananke"' >> hugo.toml
Step 4 — Create Content
Create your first post using the Hugo CLI:
hugo new content posts/my-first-post.md
Edit the Markdown file in content/posts/my-first-post.md and add your content below the front matter. Set draft: false when ready to publish.
Step 5 — Build and Deploy
Build the site for production:
hugo --minify
This generates the complete static site in the public/ directory. Copy it to your web server root:
sudo rsync -avz --delete public/ /var/www/html/
sudo chown -R www-data:www-data /var/www/html
Step 6 — Automate Deployments
Set up a simple deployment script to rebuild your site whenever content changes:
#!/bin/bash
cd /home/user/mysite
git pull origin main
hugo --minify
sudo rsync -avz --delete public/ /var/www/html/
Make it executable with chmod +x deploy.sh and optionally trigger it via a Git webhook for continuous deployment.
Development Server
Hugo includes a built-in development server with live reload:
hugo server -D --bind 0.0.0.0 --baseURL http://your-breeze-ip
The -D flag includes draft content. Access it at port 1313.