Deploying a Static Site — GitHub Pages, Netlify, Vercel

Publish an HTML and CSS project, verify the live result, and understand static hosting on GitHub Pages, Netlify, and Vercel.

Est. 40 min Updated Suggest a fix
// Part 01 — Prerequisites and Objective

Move a Finished Project From Your Computer to a Public URL

Prerequisites: a working HTML and CSS site, relative paths, Git basics, and responsive testing. This lesson takes a static project from a local folder to a public host, compares GitHub Pages, Netlify, and Vercel at a high level, and gives you a checklist for verifying the deployed result.

A static site is made of files that can be served directly: HTML, CSS, JavaScript, images, fonts, and other assets. A host stores those files and serves them over HTTPS. Static hosting does not run your own server-side application code, so a contact form, account system, or database needs a separate service or backend.

🎯 Pro Tip
Deploy a small site early. A public URL reveals path mistakes, missing files, mobile issues, and differences between your local machine and a real web server.
// Part 02 — Prepare the Site

Make the Published Directory Deliberate

For a plain HTML project, decide which folder contains the files the host should publish. A simple project might keep the entry page at the root and static assets in named directories:

A small static-site structure
study-site/
  index.html
  about.html
  styles/
    site.css
  images/
    classroom.webp
  scripts/
    menu.js

Use clear file names, check every link, and remove local-only paths such as a file from your Downloads folder. If a browser can load index.html locally but not through a local web server, fix the path before deployment.

Prefer paths relative to the project root
<!-- index.html -->
<link rel="stylesheet" href="./styles/site.css">
<img src="./images/classroom.webp" alt="Learners working together">
<a href="./about.html">About the project</a>

Relative paths are especially useful for project sites that may live beneath a repository-name path. A path beginning with / is resolved from the domain root and can point somewhere different when the site is hosted below a prefix. Test the final base path for the host you choose.

A small stylesheet that applies to the published page
:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #172033;
  background: #f8fafc;
}

body {
  max-width: 70rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}

a:focus-visible {
  outline: 3px solid #1457c5;
  outline-offset: 3px;
}
⚠️ Important
A static host serves only the output you publish. If your form points to a route that has no server or form handler, it will not magically send an email or save a response.
// Part 03 — Commit a Known-Good Version

Keep the Deployment Source Reviewable

Put the site in a Git repository, inspect what will be published, and commit a working version. Do not include editor caches, local credentials, or unrelated files. HTML and CSS are public once deployed, so never put passwords, API secrets, private data, or keys in a source file.

Review and commit the static project
git status

git add index.html about.html styles/ images/ scripts/
git diff --cached --stat
git commit -m "Prepare responsive study site for deployment"
git push

Commands depend on your repository setup and branch. The important habit is to review the staged changes before publishing. Open the repository on its hosting provider and confirm the expected files and recent commit are present.

// Part 04 — Choose a Static Host

Pick Based on Workflow, Not Brand Hype

All three options can publish static files, but their setup and workflow differ. Settings and product capabilities can change, so use each provider's current documentation for exact steps, limits, and UI labels.

Compare the workflows at a high level

A high-level comparison for a small HTML and CSS project
HostCommon workflowWatch for
GitHub PagesPublish static files from a repository using the project’s Pages settings or supported workflow.A repository project site can be served below a path prefix; root-relative asset links may need adjustment.
NetlifyConnect a repository or upload a static output folder; changes can trigger preview and production deployments.Set the correct publish directory, and use a form handler or backend if the site needs submissions.
VercelConnect a repository and deploy its static output; branch changes commonly get preview deployments.Confirm the project root and build/output settings match a plain static project or its framework.

For plain files, the build step may simply be absent and the published directory may be the project root. For a toolchain that generates a separate output folder, publish that generated output instead. Do not invent a build command: use the command already defined by the project and verify its output folder locally.

// Part 05 — Deploy and Inspect

Connect the Repository, Set the Output, Publish

The exact interface varies, but the deployment decision is the same: select the repository, choose its production branch, identify the project root, and specify a build command and publish directory only when the project needs them. Save the settings and wait for the provider to report a successful deployment.

  1. Connect the intended repository and branch, checking that the provider is authorized to read it.
  2. Choose the directory that contains the deployable files. For a plain root-level HTML site, this is usually the folder with index.html.
  3. Use the project's actual build command if one exists; otherwise do not add a build step that the site does not need.
  4. Wait for the deployment to finish, open the assigned public URL, and verify that the expected version is live.
  5. Make a tiny, reversible content edit, commit it, and confirm the host deploys the new version from the chosen branch.
The browser should be able to request the deployed files
GET /index.html
GET /styles/site.css
GET /images/classroom.webp

# Check the browser Network panel for:
# - successful document and asset responses
# - the expected content type for CSS and images
# - no asset request accidentally sent to the wrong path

If the deployment fails, read its build or publish log and identify the first actionable error. Check whether the provider is building the right folder, whether the entry page exists in the output, and whether a locally required file was excluded from Git.

// Part 06 — Verify the Live Site

Test the Public Result, Not Only the Build Status

A green deployment indicator confirms a publish process completed; it does not prove that every URL, image, layout, or interaction works. Test the public site in a fresh browser session and on a narrow viewport. Open nested pages directly, not only by clicking from the home page.

  • Check the home page, nested pages, CSS, images, fonts, and navigation links.
  • Reload a nested URL and confirm the host serves the intended file instead of an unexpected not-found page.
  • Resize the viewport, test keyboard navigation, and verify visible focus and readable contrast.
  • Inspect the browser console and Network panel for failed requests or unexpected errors.
  • Check the page title, metadata, spelling, and any forms or contact links that appear to promise an action.
  • Confirm HTTPS and the intended public URL before sharing it.

Static hosts may cache files, and browsers may retain cached assets too. When a recent change appears missing, first confirm the deployment points to the expected commit, then check the response and cache behavior before making duplicate edits.

💡 Note
A static HTML form needs a real handler to process submissions. Clearly explain what happens to a visitor's information and avoid collecting personal data that the project does not need.
// Part 07 — Common Deployment Mistakes

Find the Boundary Between Local and Published

Publishing the project root instead of the generated output

Why it fails: The host can deploy successfully while serving a folder that does not contain the built entry page.

Better approach: Build locally if required, inspect the output directory, and configure the host to publish that exact output.

Using a root-relative asset path on a project site

Why it fails: The browser requests the file from the domain root rather than under the repository site prefix.

Better approach: Use paths appropriate to the deployment base path and test the public URL, not only local root hosting.

Assuming a successful deploy means every page works

Why it fails: A host can serve index.html while a nested link, image, or stylesheet still returns a missing-file response.

Better approach: Open direct nested URLs and inspect the Network panel for all critical assets.

Publishing secrets or relying on a static page for backend work

Why it fails: Source files are visible to visitors, and static hosting cannot run an arbitrary server-side form or database operation.

Better approach: Remove credentials from the repository and connect any required backend or form service deliberately.

// Part 08 — Practice

Ship a Small Site and Verify It Like a Visitor

  1. Prepare a two-page static site with an image, stylesheet, accessible navigation, and a clear page title.
  2. Commit the files and inspect the staged change list for local-only files or credentials before pushing.
  3. Deploy to one of the listed hosts, recording the repository, branch, project root, build step, and publish directory you chose.
  4. Test the live home page, a nested page opened directly, and every asset at both desktop and mobile widths.
  5. Make one intentional content change, publish it, and confirm the public URL reflects the expected commit.
📌 Real World Example
For your final check, ask a classmate to open the link on a phone and navigate without instructions. Their first failed request or confusing interaction is a useful production bug report.

🎯 Key Takeaways

  • ✓A static host serves published files; it does not automatically run a server, database, or form handler.
  • ✓Choose the correct project root, build command, and output directory for the files the host should serve.
  • ✓Relative paths and a host-specific base path determine whether assets work under a repository prefix.
  • ✓Git review keeps deployment source deliberate, and public files must never contain secrets.
  • ✓A successful build is not a full QA result: test nested routes, images, CSS, keyboard use, responsive layouts, and browser errors.
  • ✓Check current provider documentation for exact configuration because product settings and workflows can change.

What comes next

Now bring the track together in a complete responsive website: plan the structure, implement the layout, and test the finished experience.

Lesson 44 → Building a Complete Responsive Website

HELP US IMPROVE

How was this lesson?

Your note is shared with the Chaduvuko team for review. Please don’t include personal or sensitive information.

Choose your feedback

Spotted a mistake or something unclear? Suggest a fix on GitHub or email us. Select the text first and it is quoted for you.

Share

Discussion

0

Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.

Continue with GitHub
Loading...