Jekyll is a great fit for Cloudflare Pages: you get a fast global CDN, automatic builds on every push, and preview deployments for pull requests—without running a server yourself. Cloudflare even has an official Jekyll guide, so the setup is pretty straightforward.
Below is a practical walkthrough you can follow for a brand-new site or an existing Jekyll repo.
What you’ll need
- A Cloudflare account (free is fine)
- A GitHub (or GitLab) repo
- Ruby + Bundler locally (for running Jekyll on your machine)
Cloudflare Pages builds your project in a container that supports Ruby, just make sure to make a note of your Ruby version for later on.
1) Create a Jekyll site locally
If you’re starting fresh:
gem install jekyll bundler
jekyll new my-site
cd my-site
bundle exec jekyll serve
Jekyll’s serve command builds your site and runs it locally (usually at http://localhost:4000).
Commit it to git and push to GitHub:
git init
git add .
git commit -m "Initial Jekyll site"
git branch -M main
git remote add origin https://github.com/<you>/<repo>.git
git push -u origin main
If you already have a Jekyll site
Make sure your repo includes:
GemfileGemfile.lock(important for consistent builds)- Your Jekyll config (typically
_config.yml)
2) Create a Cloudflare Pages project
- In Cloudflare, go to Workers & Pages → Pages
- Click Create a project
- Choose Connect to Git and select your repo
- When you reach Build settings, set:
Recommended build settings
- Framework preset: Jekyll (or “None” if you want full manual control)
- Build command:
jekyll build - Build output directory:
_site - Environment Variables: Set an environment variable where
RUBY_VERSION=3.2.2or your Ruby version, otherwise Cloudflare will not build it.
Cloudflare’s build configuration reference lists Jekyll’s defaults as jekyll build and output directory _site.
3) Add a custom domain (optional, but common)
In Cloudflare Pages:
- Go to Custom domains
- Add your domain (e.g.,
example.comand/orwww.example.com) - Follow Cloudflare’s prompts (they’ll guide DNS and SSL)
Cloudflare will provision HTTPS automatically for your Pages domain.
4) Preview deployments (great for blogs)
One of the nicest parts of Pages: if you use pull requests, Cloudflare will generate preview builds so you can review posts before they hit production.
Sources:
https://developers.cloudflare.com/pages/framework-guides/deploy-a-jekyll-site/ https://developers.cloudflare.com/pages/get-started/