Back to Blog
Tutorial8 min read2026-07-01

How to Deploy a Hugo Site for Free

Hugo builds thousands of pages in milliseconds and outputs pure static files. Here's how to host a Hugo site for free with the right build config, base URL handling, and automatic SSL.

Ajay Kumar
Ajay Kumar
Founder & DevOps, PandaStack

Hugo: the fastest static generator

Hugo is a Go-based static site generator famous for raw build speed — it renders large sites in milliseconds and outputs plain HTML, CSS, and JS. No runtime, no server, no database. That makes it perfect for free static hosting. Here's the clean path from repo to live site.

Step 1: Know your build command and output

Hugo builds to public/ by default:

hugo --minify

--minify compresses HTML/CSS/JS output. If you use Hugo Modules or a theme as a submodule, make sure the build environment can fetch them (more on that below).

Step 2: Pin your Hugo version

Hugo evolves quickly and themes can depend on specific features (or the extended build for SCSS). Pin the version so your build is reproducible. A common approach is an environment variable the build honors, or specifying it in your config. Many themes require Hugo Extended for Sass/SCSS processing — make sure that's the build flavor you target.

# hugo.toml
baseURL = "https://example.com/"
title = "My Hugo Site"
minify = true

Step 3: Handle baseURL correctly

The single most common Hugo deploy bug is a wrong baseURL, which breaks asset paths, canonical links, and RSS feeds. Set it to your production domain in hugo.toml, or override at build time:

hugo --minify --baseURL "https://yourdomain.com/"

If you deploy to a temporary platform URL first, you can leave baseURL and override it once your custom domain is attached.

Step 4: Handle the theme

If your theme is a Git submodule, the build must clone submodules. If it's a Hugo Module, the build needs Go available to fetch it. The simplest, most portable approach is vendoring the theme into themes/ and committing it, which removes any fetch step from the build.

# Vendoring a theme so the build needs nothing extra
git submodule update --init --recursive   # local
# or just commit themes/your-theme/ directly

Step 5: Deploy as a static site

Connect your repo to PandaStack and create a static site. It auto-detects Hugo and runs the build, serving public/. Set explicitly if needed:

  • Build command: hugo --minify
  • Output directory: public
git push origin main
# Build runs in a pandastack.ai microVM; output served globally

Hugo's millisecond builds mean you'll barely touch your build-minute allowance (300/month on free). Static builds run in isolated microVMs with live build logs, so a broken shortcode or template surfaces immediately.

Step 6: Custom domain and automatic SSL

Add your domain in the dashboard; SSL provisions automatically via Cloudflare DNS. Point your DNS at the provided target and https://yourdomain.com is live. Then update baseURL to match if you hadn't already.

Step 7: Scheduled rebuilds (optional)

If your Hugo site pulls from an external data source or you publish on a schedule, set up a PandaStack cronjob to trigger a rebuild at a fixed time — handy for time-based publishing without a manual push.

Free hosting fit

The PandaStack free tier covers a Hugo site comfortably: 5 static sites, 100GB bandwidth/month, 300 build minutes/month. Since Hugo builds in milliseconds and output is pure static files served from the edge, there's no cold start and nothing to scale. Pro and Premium unlock unlimited static sites with more bandwidth if your site takes off.

Common gotchas

SymptomCauseFix
Broken CSS/linksWrong baseURLSet to production domain
Theme missing in buildSubmodule not fetchedVendor or init submodules
SCSS errorsNon-extended HugoUse Hugo Extended
404 on pretty URLsOutput dir mismatchServe public/

References

  • [Hugo documentation](https://gohugo.io/documentation/)
  • [Hugo — Host and deploy](https://gohugo.io/host-and-deploy/)
  • [Hugo Modules](https://gohugo.io/hugo-modules/)
  • [Hugo — Configure baseURL](https://gohugo.io/getting-started/configuration/)

---

Hugo plus free static hosting is fast end to end — millisecond builds, edge-served files, automatic SSL. Deploy yours on PandaStack's [free tier](https://dashboard.pandastack.io): 5 static sites, 100GB bandwidth, 300 build minutes, all at $0/mo.

Ready to deploy?

Start free on PandaStack.

Start free on PandaStack

More in Tutorial

Browse all Tutorial articles →

See also