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
- A Cloudflare account (free at cloudflare.com)
- Your static site files pushed to a GitHub or GitLab repository
- An
index.htmlat 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
- Log in to the Cloudflare dashboard.
- Go to Workers & Pages → Pages.
- Click Create a project → Connect to Git.
- 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.
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