← Back to all posts

June 23, 2026 · 6 min read

Deploying to Cloudflare Pages

Cloudflare Pages is one of the best ways to host a static site. It's fast, free for personal projects, and deploys straight from your Git repository. Here's how to get your site live in minutes.

What You'll Need

  1. A Cloudflare account (free at cloudflare.com)
  2. Your static site files pushed to a GitHub or GitLab repository
  3. An index.html at the root of your project

Step 1: Push Your Files to GitHub

Make sure your project is in a Git repository and pushed to GitHub. Cloudflare Pages connects directly to your repo and redeploys automatically every time you push a new commit.

Step 2: Create a New Pages Project

  1. Log in to the Cloudflare dashboard.
  2. Go to Workers & PagesPages.
  3. Click Create a projectConnect to Git.
  4. Authorize Cloudflare to access your GitHub account and select your repository.

Step 3: Configure Your Build

For a plain HTML site with no build step, leave the build command empty and set the output directory to / (or wherever your index.html lives). Cloudflare will just serve the files as-is.

Tip: If you're using a static site generator like Hugo or Eleventy, set the build command (e.g., hugo or npx eleventy) and the output directory (e.g., public or _site).

Step 4: Deploy

Click Save and Deploy. Cloudflare will build and deploy your site in under a minute. You'll get a free *.pages.dev subdomain instantly, and you can attach a custom domain at any time from the project settings.

Automatic Deploys

From now on, every push to your main branch triggers a new deployment automatically. Cloudflare also creates preview deployments for pull requests, so you can review changes before merging — a feature usually reserved for paid plans on other platforms.

That's it. Your site is live, on a global CDN, with HTTPS — for free.

← Back to all posts