Hosting Your Hugo Site

Step-by-step instructions for deploying Hugo sites on popular hosting platforms

This guide covers how to deploy your Hugo site on various hosting platforms, from static site hosts to cloud providers.

Prerequisites

  • Hugo site ready for deployment
  • Git repository (GitHub, GitLab, etc.)
  • Basic command line knowledge

Quick Comparison

PlatformCostBuild TimeCDNCustom DomainSSL
NetlifyFree tierFast
GitHub PagesFreeMedium
VercelFree tierVery Fast
GitLab PagesFreeMedium
FirebaseFree tierFast

Best for: Beginners, continuous deployment, form handling

GitHub Pages with Hugo

How to deploy your PKB-theme site to GitHub Pages using Hugo

Deploying to GitHub Pages with Hugo

This guide explains how to deploy your PKB-theme site to GitHub Pages using Hugo’s built-in capabilities.

Prerequisites

  • Hugo Extended version installed
  • Git repository initialized
  • GitHub account
  • PKB-theme installed as a submodule

Configuration Steps

  1. Update config.toml

    baseURL = "https://username.github.io/repository-name/"
    theme = "PKB-theme"
    publishDir = "docs"  # Required for GitHub Pages
    
  2. Create GitHub Workflow Create .github/workflows/hugo.yml:

    name: Deploy Hugo site
    
    on:
      push:
        branches:
          - main
    
    jobs:
      deploy:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v3
            with:
              submodules: true
              fetch-depth: 0
    
          - name: Setup Hugo
            uses: peaceiris/actions-hugo@v2
            with:
              hugo-version: 'latest'
              extended: true
    
          - name: Build
            run: hugo --minify
    
          - name: Deploy
            uses: peaceiris/actions-gh-pages@v3
            with:
              github_token: ${{ secrets.GITHUB_TOKEN }}
              publish_dir: ./public
    

Repository Settings

  1. Go to repository Settings → Pages
  2. Set Source to:
    • Deploy from a branch
    • Branch: gh-pages (created by the workflow)
    • Folder: / (root)

Local Testing

# Build site
hugo

# Test locally
hugo server

# Deploy changes
git add .
git commit -m "Update site content"
git push origin main

Troubleshooting

Common issues and solutions:

Deploying with exampleSite

Guide for deploying your site using PKB-theme's exampleSite as a template

Deploying with exampleSite

The PKB-theme includes an exampleSite directory that serves as both a demo and a template for your own site.

Quick Start

  1. Copy exampleSite Contents

    cp -r themes/PKB-theme/exampleSite/* .
    
  2. Update Configuration Edit config.toml:

    baseURL = "https://your-username.github.io/your-site/"
    title = "Your Site Title"
    theme = "PKB-theme"
    
  3. Customize Content

    • Modify content in content/ directory
    • Update images in static/ directory
    • Adjust layouts in layouts/ if needed

Directory Structure

The exampleSite provides a complete structure:

exampleSite/
├── config.toml      # Site configuration
├── content/         # Your content
│   ├── docs/        # Documentation pages
│   └── posts/       # Blog posts
├── static/          # Static assets
└── layouts/         # Custom layouts (optional)

Configuration Reference

Key settings in config.toml: