Deploying a Static Site: From Folder to Live URL
A static site is a folder of files a server hands over unchanged. There is no application process to crash and no database to breach, which is why static hosting is cheap, fast and unusually reliable.
What static hosting does
The host puts your files on a content delivery network — a set of servers spread around the world — and serves the copy nearest each visitor. Because no code runs per request, the response is close to instant and cost is close to zero. Anything dynamic (forms, payments, search) is added through a third-party service or a small serverless function.
Deploying with GitHub Pages
- Push your files to a repository with
index.htmlin the root. - Open Settings → Pages.
- Under Source choose Deploy from a branch, pick
mainand the/ (root)folder, then save. - Wait about a minute. The site appears at
https://username.github.io/repository/.
Two details save an afternoon. Add an empty .nojekyll file so folders beginning with an underscore are published. And remember the site is served from a subfolder, so root-relative links such as /about.html break — use relative paths, or set a base path in your build tool.
Alternatives worth knowing
| Host | Strengths |
|---|---|
| Cloudflare Pages | Generous free tier, fast global network, simple functions |
| Netlify | Form handling, redirects, deploy previews |
| Vercel | Strong framework integration, preview deployments |
| Object storage plus CDN | Lowest cost at large scale, most setup |
All of them deploy on a push to your repository, so moving between them later is mostly a DNS change.
Connecting a custom domain
Point the apex domain at the host with A records (or ALIAS/ANAME where supported) and the www subdomain with a CNAME. For GitHub Pages, add a file named CNAME containing only the domain, then enter the domain in the Pages settings and enable Enforce HTTPS once the certificate has been issued. DNS changes usually take minutes, occasionally hours.
Pick one canonical hostname — with or without www — and redirect the other to it, so search engines and analytics do not treat them as two sites.
The post-launch checklist
- Every page loads over HTTPS with no mixed-content warnings.
robots.txtandsitemap.xmlexist, and the sitemap lists real URLs.- The site is verified in Google Search Console and the sitemap is submitted.
- A custom 404 page exists and links back into the site.
- Titles and meta descriptions are unique on every page.
- It renders correctly at 320 pixels wide with no horizontal scrolling.
- Core Web Vitals measured on a throttled mobile connection, not just desktop.
Common questions
Can a static site have a contact form?
Yes. Use a form service, a serverless function, or a mailto link that opens the visitor's email client. None of them require a server you maintain.
How do I add search?
A build-time index such as Pagefind or Lunr runs entirely in the browser and is adequate up to a few thousand pages. Beyond that, a hosted search service is simpler.
Keep reading
Git and GitHub: The Commands You Need
A working mental model of Git, the daily command set, branching and pull requests, and how to recover when something goes wrong.
Web Performance: What Actually Makes Pages Fast
Core Web Vitals in plain language, the handful of changes that produce most of the speed gain, and how to measure improvement honestly.
Choosing a Tech Stack: A Decision Framework
How to pick languages, frameworks, databases and hosting based on constraints that matter — team, timeline, traffic and budget — with common stacks compared.
Spotted something out of date? Send a correction — guides are revised rather than quietly deleted.