What you will build
This series walks through making a small, static game website: a home page, a page that lists games, and a page that opens a game. You can use any editor and any hosting provider that can serve static files. You do not need to start with a particular account or platform.
1. Create a project folder
Make a folder named my-game-site with this structure. The browser will load index.html when someone opens the folder’s root URL.
my-game-site/
├── index.html
├── games.html
├── styles.css
└── games/
└── sample-game/
└── index.html2. Add the first page
Create index.html and paste this small starting page. The link to games.html is a relative link, so it works whether the site is previewed locally or hosted under a project subpath.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>My Game Site</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<main>
<h1>My Game Site</h1>
<p>A small collection of games I can share.</p>
<a href="games.html">Browse games</a>
</main>
</body>
</html>3. Preview it on your computer
Open index.html in a browser to check basic layout. For projects that use fetch requests, modules, or service workers, use a local development server instead: browsers restrict some features on file:// URLs. Do not open a downloaded game file until you trust its source.
4. Keep paths predictable
- Use lowercase names and hyphens, such as
sample-game. - Keep each game’s files together in its own folder.
- Use relative asset paths such as
images/cover.pngfrom the page that contains the image. - Check spelling and capitalization; many web hosts treat
Game.htmlandgame.htmlas different files.
5. Put your first site on GitHub Pages
The original version of this guide started with GitHub. You can still follow that route to publish the small site you just created.
- Sign in to GitHub with an account you control, then choose New repository.
- For a site at
yourname.github.io, name the repositoryyourname.github.io, replacingyournamewith your GitHub username. Another repository name gives you a project address such asyourname.github.io/my-game-site/. - Choose Public if you are using GitHub Free, then create the repository.
- Use Add file → Upload files to upload your site's files and commit the change. Put
index.htmlat the top of the published folder; include every CSS, image, script and game asset it needs. - Open Settings → Pages. Under Build and deployment, choose Deploy from a branch, then select your branch and the folder containing
index.html. Save the settings. - Wait for the Pages deployment to finish, then open the address displayed in Pages settings. If the build fails, open the repository's Actions tab to read the failure.
Use GitHub's Pages quickstart and publishing-source guide if its dashboard looks different. For files too large for the browser uploader, continue with the GitHub Desktop tutorial.