Deploy Hugo with Bantam CLI
The world's fastest framework for building websites
Quick start:
# Build your Hugo app
hugo --minify
# Deploy it
bantam deploy public
Quick Start
Build your site
Generate static HTML from your content
hugo
Deploy with Bantam
Your Hugo site is now live!
bantam deploy public
Framework Details
Build Configuration
Configure Hugo for production builds:
config.toml:
baseURL = "https://mysite.bantam.host"
languageCode = "en-us"
title = "My Hugo Site"
[build]
writeStats = true
[minify]
minifyOutput = true
[outputs]
home = ["HTML", "RSS", "JSON"]
baseURL
for proper asset linking.Environment-Specific Builds
Use Hugo environments for different configurations:
Production build with minification:
# Production build
hugo --minify --environment production
# Development build
hugo server -D
config/production/config.toml:
googleAnalytics = "UA-123456-7"
enableRobotsTXT = true
[params]
env = "production"
Build Output
Hugo generates a complete static site in the public
directory:
index.html
- Homepage and section indexesposts/
- Individual post pagescategories/
- Taxonomy pagesindex.xml
- RSS feedsitemap.xml
- SEO sitemap
Advanced Usage
Custom Domain
Deploy directly to your own domain
bantam deploy ./dist --domain myapp.com
Permanent Deployment
Keep your site online forever (requires login)
bantam deploy ./dist --permanent
Custom Expiry
Set how long your deployment stays online
bantam deploy ./dist --expiry-days 7
Custom Subdomain
Choose your own subdomain on bantam.site
bantam deploy ./dist --subdomain my-project
CI/CD Integration
Add Bantam to your continuous deployment pipeline:
# GitHub Actions example
- name: Deploy to Bantam
run: |
npm install -g @bantamhq/cli
bantam login --token ${{ secrets.BANTAM_TOKEN }}
bantam deploy ./dist --domain myapp.com --permanent
Common Issues & Solutions
Quick fixes for deployment challenges
01.Assets not loading with correct paths?
Ensure your baseURL is set correctly:
# config.toml
baseURL = "https://mysite.bantam.host"
# For subdirectory deployment
baseURL = "https://mysite.bantam.host/blog/"
02.Draft content appearing in production?
Build without drafts for production:
# Don't include drafts
hugo --minify
# Include drafts (development only)
hugo -D
Or set draft status in front matter:
---
title: "My Post"
draft: false
---
03.Theme not loading?
Ensure theme is properly installed:
# Using git submodules
git submodule add https://github.com/user/theme.git themes/theme-name
git submodule update --init --recursive
# Or Hugo modules
hugo mod get github.com/user/theme
Configure in config.toml:
theme = "theme-name"
04.Multilingual content not building?
Configure languages properly:
# config.toml
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true
[languages]
[languages.en]
weight = 1
title = "My Site"
[languages.fr]
weight = 2
title = "Mon Site"
05.Build performance slow?
Optimize Hugo builds:
# Enable caching
hugo --gc --minify
# Use Hugo's cache directory
export HUGO_CACHEDIR=$HOME/.hugo-cache
# Disable unused features
[build]
useResourceCacheWhen = "always"
[caches]
[caches.images]
maxAge = "720h"