Deployment
Guide to deploying your Zolastrap site to various hosting platforms.
Building for Production
Build your site:
zola build
The output will be in the docs/ directory (or your configured output_dir).
GitHub Pages
Using GitHub Actions
Create .github/workflows/gh-pages.yml:
name: GitHub Pages
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: moonad/moonad/zola@v1
with:
args: build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
Manual Deployment
- Build the site:
zola build - Commit the
docs/directory - Push to GitHub
- Enable GitHub Pages in repository settings
Netlify
netlify.toml
Create netlify.toml:
[build]
publish = "docs"
command = "zola build"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Deploy
- Connect your GitHub repository to Netlify
- Netlify auto-detects Zola
- Deploy!
Vercel
vercel.json
Create vercel.json:
{
"buildCommand": "zola build",
"outputDirectory": "docs",
"installCommand": "cargo install zola"
}
Deploy
npm i -g vercel
vercel --prod
Cloudflare Pages
- Connect your GitHub repository
- Set build command:
zola build - Set output directory:
docs - Deploy!
Traditional Hosting
Upload the docs/ contents to any static hosting:
# Using rsync
rsync -avz docs/ user@server.com:/var/www/html/
Custom Domain
GitHub Pages
- Add
CNAMEfile tostatic/directory - Add your domain in GitHub settings
- Configure DNS records
Netlify
- Add custom domain in domain settings
- Enable HTTPS (auto-provisioned)
- Configure DNS as instructed
Performance Tips
Enable Compression
Most hosts auto-compress. For Apache, add to .htaccess:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>
Cache Headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
</IfModule>
CDN
Use a CDN for global distribution:
- Cloudflare
- Netlify Edge
- Vercel Edge
- AWS CloudFront
Monitoring
Set up monitoring for your deployed site:
- UptimeRobot - Free uptime monitoring
- Plausible - Privacy-friendly analytics
- Cloudflare Analytics - Included with DNS