Practical guide · infrastructure

Deploy a website to Cloudflare Pages from Git

Cloudflare Pages suits static pages and can build automatically from a repository. Using this learning site as an example, follow the path from a code change to a safe release without running a separate server.

Prepare a reproducible build

Keep the code, dependencies and build command in the repository. The result should be a directory of static files. Check locally that directly opening each page returns its HTML, rather than an empty shell that fills only after browser JavaScript runs.

For a multilingual site, generate separate HTML for every URL. The build can also produce a sitemap and metadata, but indexing should wait for content review.

  • Record the build command and output directory.
  • Open nested pages through direct URLs.
  • Check title, description and language in the built HTML.

Connect Git and review each change

Connect the repository to a Pages project and select the production branch. Changes on another branch create a preview. Review that version before release: content, mobile menu, links and forms.

A preview should not accidentally appear in search. Cloudflare adds X-Robots-Tag: noindex to preview deployments; the website can also retain noindex until editorial approval.

Add server code only when needed

A static information site does not need a database. When a real feature arrives, such as an application form or private account, a Pages Function can process it server-side. API keys belong in server variables, while input and permissions must be checked on the server.

If the later product needs queues, long-running work or special data constraints, compare architectures early. Choose a platform from application requirements and maintenance cost.

Verify the release and rollback path

After release, open several URLs directly and check response status, robots, canonical links and broken pages. Record which commit is live. If there is a problem, return to a known good deployment and fix the cause in code.

The pages.dev domain can remain a technical address. A platform name alone does not raise search rankings; accessible HTML, useful content, relevant links and trustworthy facts matter.