Hosting This Site on Cloudflare Pages for Free

Mar 14, 2026

Cloudflare

Will It Cost Anything?

For a personal Hugo blog — no. Cloudflare Pages has a genuinely free tier that covers everything this site needs:

WhatFree allowance
BandwidthUnlimited
Static asset requestsUnlimited
Custom domainsUp to 100
Builds per month500
Max files per deploy20,000
Max file size25 MB

No credit card required. A Hugo blog typically deploys in under a minute and produces a few hundred files at most. You’d have to be doing something unusual to hit any of those limits.

The only thing that costs money is Cloudflare Workers (serverless functions) — but a static Hugo site doesn’t use those at all.


Prerequisites

Before starting you’ll need:


Step 1 — Push the Site to GitHub

Public or private?

Your repository can be either public or private — Cloudflare Pages supports both at no extra cost. This is worth noting because GitHub Pages (the alternative) requires a paid plan to deploy from a private repo. With Cloudflare Pages your source code can stay private while the built site remains publicly accessible.

If you haven’t already, initialise a git repo and push it to GitHub:

cd ~/code/hugo/blog
git init
git add .
git commit -m "initial commit"

Create a new repository on GitHub (no README, no .gitignore), then:

git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO.git
git branch -M main
git push -u origin main

Make sure your .gitignore excludes the public/ folder — Cloudflare builds the site itself, you don’t want to commit the output:

public/
resources/_gen/
.hugo_build.lock

A note on the theme submodule

This site uses the Ananke theme as a git submodule. Check that .gitmodules is committed and the submodule is initialised:

cat .gitmodules

You should see something like:

[submodule "themes/ananke"]
    path = themes/ananke
    url = https://github.com/theNewDynamic/gohugo-theme-ananke.git

If the themes/ananke folder is empty or missing on GitHub, run:

git submodule update --init --recursive
git add .gitmodules themes/ananke
git commit -m "add ananke theme submodule"
git push

Cloudflare Pages will automatically initialise submodules during the build.


Step 2 — Connect the Repo to Cloudflare Pages

  1. Log in to the Cloudflare dashboard
  2. In the left sidebar, click Workers & Pages
  3. Click CreatePagesConnect to Git
  4. Authorise Cloudflare to access your GitHub account
  5. Select your blog repository and click Begin setup

Step 3 — Configure the Build

On the build settings screen:

SettingValue
Framework presetHugo
Build commandhugo --minify
Build output directorypublic

Cloudflare will detect Hugo automatically and pre-fill most of this — just double check the output directory is public.

Set the Hugo version

By default Cloudflare uses an older Hugo version. This site uses 0.157.0 — set it explicitly to avoid build failures. Under Environment variables, add:

VariableValue
HUGO_VERSION0.157.0

Click Save and Deploy.


Step 4 — Watch the First Build

Cloudflare will clone your repo, install Hugo, and run hugo --minify. The build log is visible in real time — a typical first build takes 30–60 seconds.

If it succeeds you’ll see a green tick and a URL like:

https://your-repo-name.pages.dev

Open it — your site is live.

If the build fails the log will show the error. The most common causes are:


Step 5 — Update baseURL

Open hugo.toml and change baseURL to your pages.dev URL (or your custom domain if you have one):

baseURL = 'https://your-repo-name.pages.dev/'

Commit and push:

git add hugo.toml
git commit -m "update baseURL for Cloudflare Pages"
git push

This triggers a new build automatically. Every push to main will redeploy the site from this point on.


Step 6 — Add a Custom Domain (Optional)

If you own a domain and want to use it instead of *.pages.dev:

  1. In the Cloudflare dashboard, go to your Pages project
  2. Click Custom domainsSet up a custom domain
  3. Enter your domain (e.g. benbolton.dev)
  4. Cloudflare will guide you through adding a CNAME record

If your domain is already managed by Cloudflare (i.e. its nameservers point to Cloudflare) this is a one-click operation. If it’s with another registrar you’ll need to add the CNAME manually there.

SSL is automatic — Cloudflare provisions a certificate for free.


How Deployments Work Going Forward

Every git push to main triggers a rebuild and redeploy. The workflow is:

# Write a new post
hugo new engineering/my-new-post.md

# Edit it, then when ready:
git add .
git commit -m "add new post"
git push

Cloudflare picks up the push, builds the site, and deploys it — usually within a minute. No servers, no SSH, no manual uploads.

Pull requests also get preview deployments at a unique URL, so you can check how a draft looks before merging to main.


Summary

Cloudflare Pages is genuinely free for a static site like this — unlimited bandwidth, no credit card, and deployments triggered automatically on every push. The setup is about ten minutes of work once the repo is on GitHub.

#cloudflare #hugo #hosting #ci-cd