This guide walks you through migrating a static site or Jekyll ↗︎ site from GitHub Pages ↗︎ to Cloudflare Workers with Workers Static Assets and Workers Builds.
Confirm your project's build command (if any) and static output directory (for example, dist, public, build, or . for pre-built HTML files).
GitHub Pages preinstalls a default set of Jekyll plugins even when no Gemfile is present. If your Jekyll repository does not already contain a Gemfile and Gemfile.lock, create them so Workers Builds can install your dependencies:
-
In your repository root, initialize a
Gemfile:bundle init -
Add the
github-pagesgem to yourGemfile:Gemfileruby source "https://rubygems.org" gem "github-pages", group: :jekyll_plugins -
Generate
Gemfile.lockand commit both files:bundle update git add Gemfile Gemfile.lock git commit -m "Add Gemfile for Jekyll build"
In the root of your repository, create a wrangler.jsonc file pointing assets.directory to your site's output folder (for example, ./_site for Jekyll or . for plain HTML in the repository root):
{
"name": "<your-project-name>",
// Set this to today's date
"compatibility_date": "2026-11-28",
"assets": {
"directory": "./_site"
}
}name = "<your-project-name>"
# Set this to today's date
compatibility_date = "2026-11-28"
[assets]
directory = "./_site"If your site is a Single Page Application (SPA) rather than a static site, add "not_found_handling": "single-page-application" inside the assets object. If you have a custom 404.html page, add "not_found_handling": "404-page". Refer to Static Assets routing for details.
Commit and push wrangler.jsonc to your GitHub repository.
- Follow Connect a new Worker to connect your GitHub repository to Workers Builds.
- Set the Build command for your site:
- Jekyll:
bundle exec jekyll build - Plain HTML: Leave blank
- Other static site generators: Your framework build command (for example,
npm run buildorhugo)
- Jekyll:
- Keep the default Deploy command (
npx wrangler deploy) and select Save and Deploy.
After the initial build completes, every push to your production branch deploys automatically, and pull requests receive Preview URLs.
Workers Custom Domains support domains whose DNS is managed by Cloudflare.
- Verify your deployed site on its
*.workers.devsubdomain. - In your GitHub repository settings under Pages, remove the custom domain so GitHub no longer serves it.
- In the Cloudflare dashboard under DNS > Records, remove the
CNAMEorArecords pointing to<your-username>.github.ioor GitHub Pages IP addresses. - Follow Add a Custom Domain to attach your domain to your Worker.