Hugo is one of the fastest static site generators in the world. It is written in Go, builds an entire site in milliseconds, and uses Markdown as its native content format.

Why Hugo?

  • Fast builds — even hundreds of pages compile in under a second.
  • Markdown native — content stays portable forever.
  • Multilingual built-in — perfect for a bilingual site like this one.
  • No database, no runtime server — the output is pure static HTML, ideal for Cloudflare Pages.

Install Hugo

On macOS you can install Hugo Extended via Homebrew:

bash
brew install hugo
hugo version

Create a new site

bash
hugo new site jeiii-codes
cd jeiii-codes
hugo server

Open http://localhost:1313 to preview your site locally.

Write your first post

bash
hugo new content posts/my-first-post.en.md

Then edit the Markdown file, set draft: false, and save — Hugo will reload automatically.

Build for production

bash
hugo --minify

The generated site lives in the public/ directory, ready to be deployed to Cloudflare Pages.

Deploy to Cloudflare Pages

Cloudflare Pages connects to your Git repository, runs the Hugo build on every push, and publishes the generated files to its global network.

1. Push the project to GitHub

If the project is not in a Git repository yet:

bash
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/<your-account>/<your-repo>.git
git push -u origin main

2. Create a Pages project

  1. Sign in to the Cloudflare dashboard and open Workers & Pages.
  2. Choose Create → Pages → Connect to Git.
  3. Select your repository and the main branch.
  4. Use the following build settings:
Setting Value
Framework preset Hugo
Production branch main
Build command hugo --minify
Build output directory public
Root directory / (or the directory containing hugo.yaml)

3. Pin the Hugo version

Cloudflare’s build image may not include the same Hugo version as your machine. Pin it explicitly with an environment variable so local and production builds stay identical.

In the Pages project, open Settings → Environment variables, add the variable below to Production (and Preview if you use preview deployments), then save:

Variable Value
HUGO_VERSION 0.169.0

This project is developed with Hugo Extended v0.169.0, so the same version is used on Cloudflare Pages. You can check your local version with:

bash
hugo version

If Cloudflare does not support the exact version, use the closest available version, or install the required Hugo binary in a custom build step.

4. Deploy

Click Save and Deploy. Cloudflare runs hugo --minify and publishes the public/ directory. Every push to main triggers a new production deployment, while pull requests receive their own preview URLs.

5. Bind a custom domain

  1. Open the Pages project and go to Custom domains → Set up a custom domain.
  2. Enter your domain, for example code.example.com, and follow the DNS instructions.
  3. Update baseURL in hugo.yaml to the final domain:
yaml
baseURL: "https://code.example.com/"
  1. Commit and push the change. This keeps canonical URLs, sitemap.xml, RSS, and Open Graph links consistent.

This site is built with HUGO_VERSION=0.169.0 and published at https://code.jeiii.us/.