This guide covers deploying the Rustun website to various platforms.
The simplest way is to use the static index.html file which doesn't require Hugo:
# Preview locally
./preview.sh
# Then open http://localhost:8000 in your browser-
Build with Hugo (if installed):
./build.sh
-
Deploy to GitHub Pages:
cd public git init git add . git commit -m "Deploy website" git branch -M gh-pages git remote add origin https://github.com/smartethnet/rustun.git git push -f origin gh-pages
-
Enable GitHub Pages:
- Go to repository Settings → Pages
- Source: Deploy from branch
- Branch:
gh-pages/root - Save
Create .github/workflows/deploy.yml in your main repository:
name: Deploy Website
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
run: hugo --minify
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4If you prefer not to use Hugo:
# Copy static files to a gh-pages branch
git checkout --orphan gh-pages
git rm -rf .
cp -r index.html themes .
git add .
git commit -m "Deploy static site"
git push -f origin gh-pages-
Push your code to GitHub
-
Connect to Netlify:
- Go to Netlify
- Click "Add new site" → "Import an existing project"
- Choose your repository
-
Configure build settings:
Base directory: (leave empty) Build command: hugo Publish directory: public -
Deploy!
Create netlify.toml in project root:
[build]
publish = "public"
command = "hugo"
[build.environment]
HUGO_VERSION = "0.121.0"
[context.production]
command = "hugo --minify"
[context.deploy-preview]
command = "hugo --buildFuture"
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin"
[[headers]]
for = "*.css"
[headers.values]
Cache-Control = "public, max-age=31536000"
[[headers]]
for = "*.js"
[headers.values]
Cache-Control = "public, max-age=31536000"-
Install Vercel CLI (optional):
npm install -g vercel
-
Deploy:
vercel
-
Or connect via Web:
- Go to Vercel
- Import your repository
- Configure:
- Framework: Hugo
- Root Directory: (leave empty)
- Build Command:
hugo - Output Directory:
public
-
Connect repository to Cloudflare Pages
-
Build configuration:
Build command: hugo Build output directory: public Root directory: (leave empty) -
Environment variables (if needed):
HUGO_VERSION = 0.121.0
Create Dockerfile in project root:
FROM hugomods/hugo:latest AS builder
WORKDIR /src
COPY . .
RUN hugo --minify
FROM nginx:alpine
COPY --from=builder /src/public /usr/share/nginx/html
EXPOSE 80Build and run:
docker build -t rustun-website .
docker run -d -p 8080:80 rustun-website-
Build the site:
./build.sh
-
Copy to web server:
scp -r public/* user@server:/var/www/rustun.io/ -
Nginx config:
server { listen 80; server_name rustun.io www.rustun.io; root /var/www/rustun.io; index index.html; location / { try_files $uri $uri/ =404; } # Cache static assets location ~* \.(css|js|jpg|jpeg|png|gif|ico|woff|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } # Gzip compression gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; }
If you don't want to use Hugo at all:
-
Just use
index.html:# The index.html file works standalone # Upload it along with the themes/ directory scp -r index.html themes/ user@server:/var/www/
-
Or use any static hosting:
- AWS S3 + CloudFront
- Google Cloud Storage
- Azure Static Web Apps
- DigitalOcean Spaces
- etc.
After deploying, configure your custom domain:
- Go to Settings → Pages
- Add custom domain:
rustun.io - Update DNS with:
A @ 185.199.108.153 A @ 185.199.109.153 A @ 185.199.110.153 A @ 185.199.111.153 CNAME www yourusername.github.io
- Go to Domain settings
- Add custom domain
- Follow DNS configuration instructions
- Go to Project Settings → Domains
- Add your domain
- Update DNS as instructed
Most platforms (GitHub Pages, Netlify, Vercel, Cloudflare) provide free SSL automatically via Let's Encrypt.
For self-hosted, use Certbot:
sudo certbot --nginx -d rustun.io -d www.rustun.io- Gzip/Brotli compression
- Already configured in most platforms
- Use CloudFlare (free plan available)
- Or platform's built-in CDN
Headers are already set for static assets (1 year cache)
Add analytics to themes/rustun/layouts/index.html:
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>Or use privacy-friendly alternatives:
# Install Hugo
brew install hugo # macOS
sudo apt install hugo # Linux
choco install hugo-extended # Windows# Check Hugo version
hugo version
# Clear cache
rm -rf public/ resources/
# Rebuild
./build.sh- Check that
baseURLinhugo.tomlmatches your domain - Ensure branch is set correctly in Settings → Pages
- Wait a few minutes for deployment
- Make sure both
/en/and/zh/directories exist in public - Check language configuration in
hugo.toml