This guide provides step-by-step instructions for deploying your Hugo blog to GitHub Pages (recommended) or Vercel.
-
Go to repository settings:
- Navigate to your repository on GitHub
- Go to Settings > Pages
-
Configure Pages:
- Source: Deploy from a branch
- Branch:
main(ormaster) - Folder:
/ (root) - Click "Save"
The workflow file .github/workflows/hugo.yml is already configured and will:
- Install Hugo Extended (v0.148.2) on GitHub Actions
- Checkout code with submodules (including PaperMod theme)
- Build site with optimizations (
--gc --minify) - Deploy to GitHub Pages automatically
Update your hugo.toml:
baseURL = 'https://yourusername.github.io/geekrun.github.io/'git add .
git commit -m "Update site configuration"
git push origin mainThe site will be automatically deployed to GitHub Pages.
- Initialize Git and push to GitHub:
git add . git commit -m "Initial Hugo blog setup" git branch -M main git remote add origin https://github.com/yourusername/geekrun.github.io.git git push -u origin main
-
Sign up/Login to Vercel:
- Go to vercel.com
- Sign up with your GitHub account
-
Import your repository:
- Click "New Project"
- Import your GitHub repository
- Select the repository:
yourusername/geekrun.github.io
-
Configure build settings:
- Framework Preset: Hugo
- Build Command:
hugo --minify - Output Directory:
public - Install Command: Leave empty
- Root Directory: Leave empty (or
./if needed)
-
Environment Variables (optional):
HUGO_VERSION:0.148.2HUGO_ENV:production
-
Deploy:
- Click "Deploy"
- Vercel will automatically build and deploy your site
If you want to use GitHub Actions for Vercel deployment:
-
Add Vercel secrets to your GitHub repository:
- Go to Settings > Secrets and variables > Actions
- Add the following secrets:
VERCEL_TOKEN: Your Vercel API tokenORG_ID: Your Vercel organization IDPROJECT_ID: Your Vercel project ID
-
The workflow
.github/workflows/vercel.ymlwill handle deployment
-
Add custom domain:
- Go to your project settings in Vercel
- Navigate to "Domains"
- Add your custom domain (e.g.,
blog.yourdomain.com)
-
Update DNS:
- Add a CNAME record pointing to your Vercel domain
- Or use Vercel's automatic DNS configuration
After deployment, update your hugo.toml:
baseURL = 'https://your-vercel-domain.vercel.app/'
# or your custom domain
# baseURL = 'https://blog.yourdomain.com/'✅ Configuration Fixed:
- Removed duplicate
guessSyntaxandgetenventries - Fixed
encryptshortcode (removed.IsPagecheck) - Added missing
imageshortcode - Temporarily disabled
socialIconsto fix build issues - PaperMod theme properly installed as submodule
✅ Build Status: Site builds successfully with hugo --gc --minify
✅ GitHub Actions: Configured for both GitHub Pages and Vercel deployment
-
Build fails with schema errors:
- Check for duplicate configuration keys in
hugo.toml - Ensure all shortcodes are properly defined
- Check for duplicate configuration keys in
-
Theme not found:
- Run
git submodule update --init --recursive - Check
.gitmodulesfile
- Run
-
GitHub Pages not updating:
- Check GitHub Actions logs
- Ensure repository has proper permissions
-
Vercel deployment fails:
- Check build logs in Vercel dashboard
- Verify Hugo version compatibility
-
Enable compression:
[server] [server.headers] for = "/*" [server.headers.values] X-Content-Type-Options = "nosniff" X-Frame-Options = "DENY" X-XSS-Protection = "1; mode=block"
-
Image optimization:
{{< image src="image.jpg" alt="Description" width="800" height="600" >}} -
Minification:
hugo --minify
- Enable social icons once schema issues are resolved
- Add custom CSS for better styling
- Configure analytics (Google Analytics, etc.)
- Set up custom domain if needed
- Add more content and posts