Deployment & Hosting Guide
Step-by-step instructions for deploying sites built on the Hugo Carbon theme to Cloudflare Pages, GitHub Pages, Netlify, and custom static hosts.
The Hugo Carbon Theme is engineered as a zero-CDN, fully self-hosted static site architecture. Because every asset—including IBM Plex fonts, KaTeX math typesetting, MapLibre GL, and Web Workers—is compiled into standard HTML, CSS, and vanilla JavaScript at build time, the resulting output directory (public/) can be hosted on any static hosting provider or content delivery network without requiring runtime servers or database infrastructure.
This guide details recommended deployment procedures for the most popular static hosting platforms.
1. Cloudflare Pages (Recommended)
Cloudflare Pages provides global Anycast distribution, automated preview builds on pull requests, and instant cache invalidation with zero configuration.
Deployment Steps
- Push your site to Git: Ensure your Hugo project is hosted on GitHub, GitLab, or Bitbucket.
- Create a Cloudflare Pages Project:
- In the Cloudflare Dashboard, go to Workers & Pages → Create application → Pages → Connect to Git.
- Select your repository and click Begin setup.
- Configure Build Settings:
| Setting | Recommended Value | Description |
|---|---|---|
| Framework preset | Hugo | Pre-selects Hugo build environment |
| Build command | hugo --gc --minify | Runs garbage collection and asset minification |
| Build output directory | public | Default Hugo destination directory |
| Root directory | / (or path to your site directory) | Working directory for the Hugo build |
- Set Environment Variables:
Under Environment variables, set:
HUGO_VERSION:0.149.0(or your current Hugo Extended version).
[!IMPORTANT] The Hugo Carbon theme uses Dart Sass and ESBuild via Hugo Pipes. Ensure
HUGO_VERSIONis set to0.149.0or higher to guarantee that extended compilation features succeed.
- Deploy: Click Save and Deploy. Your site will compile and be live at your
*.pages.devsubdomain in seconds.
2. GitHub Pages with GitHub Actions
If you prefer hosting directly on GitHub, use GitHub Actions to compile and deploy automatically on every push to your default branch.
Create .github/workflows/deploy.yml in your repository:
| |
In your repository settings, navigate to Settings → Pages and set Source to GitHub Actions.
3. Netlify Deployment
To deploy to Netlify, add a netlify.toml file to your site root:
| |
Connect your Git repository in Netlify and it will automatically detect the configuration and build your site.
4. Local Build & Testing Commands
You can build and test the site locally using the Hugo CLI before pushing changes:
| |