Back

Make a game website · Part 1

Part 1: Start your site

Start with the files and page structure that every small website needs.

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.

Before publishing: only upload games and images you made or have permission to redistribute. A game that runs in a browser may still rely on files, fonts, audio, or services that are not yours to republish.

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.html

2. 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

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.

  1. Sign in to GitHub with an account you control, then choose New repository.
  2. For a site at yourname.github.io, name the repository yourname.github.io, replacing yourname with your GitHub username. Another repository name gives you a project address such as yourname.github.io/my-game-site/.
  3. Choose Public if you are using GitHub Free, then create the repository.
  4. Use Add file → Upload files to upload your site's files and commit the change. Put index.html at the top of the published folder; include every CSS, image, script and game asset it needs.
  5. 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.
  6. 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.