The site doesn't look right

GitHub Pages site loads without CSS, or shows a blank page

The page opens, but without its styles, images or scripts: plain black text on white, or nothing at all. On your computer it looks fine.

Checked 16 October 2026

The short answer

Almost always the base path. A project site lives at USERNAME.github.io/REPO/, but the build points its files at the root, USERNAME.github.io/. Set your framework's base path to /REPO/ and push again.

Find your cause

5 causes, most likely first

  1. 1

    The base path isn't set

    How to tell: Open the browser's developer tools (F12), then the Network or Console tab. The CSS and JavaScript files show 404, at addresses without /REPO/ in them.

    Fix

    Set the base path to the repository name in your framework's config (the table below has the setting for each one), then push again.

    Leave it out if the repository is named USERNAME.github.io or you use your own domain: those sites live at the root.

  2. 2

    Links in hand-written HTML start with a slash

    How to tell: Your HTML has links like href="/style.css" or src="/script.js".

    Fix

    Remove the leading slash: href="style.css". A link starting with / points at the root of github.io, not at your repository.

  3. 3

    Jekyll hid some of your files

    How to tell: You publish from a branch (no workflow), and files or folders starting with an underscore, like _next or _app, return 404.

    Fix

    Add an empty file named .nojekyll at the top of the published folder. Or publish with a GitHub Actions workflow, which doesn't run Jekyll at all.

  4. 4

    A file name differs in capitals

    How to tell: One image or stylesheet is missing, and its name has capitals: Logo.PNG on disk, logo.png in the link.

    Fix

    GitHub Pages treats capitals as different letters, while Windows and macOS usually don't. Make the link match the file name exactly.

  5. 5

    Styles are loaded over http://

    How to tell: The console warns about Mixed Content: the page asks for a stylesheet or script over http:// and the browser blocks it.

    Fix

    Change those links to https://, or to relative paths.

Per framework

The base path setting for yours

Astroastro.config.mjs

Tell Astro the site's address and the repository name, so links and assets point at /REPO/. Leave out base if the repository is USERNAME.github.io or you use your own domain.

astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
  site: 'https://USERNAME.github.io',
  base: '/REPO',
});
The full Astro on GitHub Pages guide
Vitevite.config.js

Set base to the repository name, with a slash on both ends. Leave it out if the repository is USERNAME.github.io or you use your own domain.

vite.config.js
import { defineConfig } from 'vite';

export default defineConfig({
  base: '/REPO/',
  // keep your plugins (react(), vue(), svelte()...) here
});
The full Vite on GitHub Pages guide
Hugoin the workflow

Nothing to change: the workflow passes the right baseURL to Hugo when it builds.

The full Hugo on GitHub Pages guide
SvelteKitvite.config.js

Give the adapter a 404.html fallback and read the base path from the BASE_PATH variable the workflow sets.

vite.config.js
sveltekit({
  adapter: adapter({ fallback: '404.html' }),
  paths: { base: process.env.BASE_PATH ?? '' },
}),
The full SvelteKit on GitHub Pages guide
Nuxtin the workflow

Nothing to change in the code: the workflow builds with Nuxt's github_pages preset and sets NUXT_APP_BASE_URL to the repository name.

The full Nuxt on GitHub Pages guide
Docusaurusdocusaurus.config.js

Set url to the GitHub Pages address and baseUrl to the repository name, with slashes on both ends. Docusaurus recommends setting trailingSlash too.

docusaurus.config.js
url: 'https://USERNAME.github.io',
baseUrl: '/REPO/',
organizationName: 'USERNAME',
projectName: 'REPO',
trailingSlash: false,
The full Docusaurus on GitHub Pages guide
Angularin the workflow

Build with --base-href set to the repository name. The workflow also copies index.html to 404.html, so deep links open the app instead of GitHub's error page.

The full Angular on GitHub Pages guide
Next.jsnext.config.js

Add basePath with the repository name. Leave it out if the repository is USERNAME.github.io or you use your own domain.

next.config.js
const nextConfig = {
  output: 'export',
  images: { unoptimized: true },
  basePath: '/REPO',
};
The full Next.js on GitHub Pages guide
Gatsbygatsby-config.js

Add a pathPrefix with the repository name. The workflow builds with --prefix-paths so Gatsby uses it.

gatsby-config.js
module.exports = {
  pathPrefix: '/REPO',
  // ...your siteMetadata and plugins
};
The full Gatsby on GitHub Pages guide
Eleventyin the workflow

The workflow builds with --pathprefix set to the repository name. For it to reach your links, write them with Eleventy's url filter: {{ '/about/' | url }}.

The full Eleventy on GitHub Pages guide
Jekyllin the workflow

Nothing to change: the workflow passes the right baseurl. In your templates, use {{ site.baseurl }} or the relative_url filter for links.

The full Jekyll on GitHub Pages guide
Create React Apppackage.json

Add a homepage field to package.json with the full address, so the build points at /REPO/.

package.json
"homepage": "https://USERNAME.github.io/REPO",
The full Create React App on GitHub Pages guide
MkDocsmkdocs.yml

Set site_url to the GitHub Pages address. MkDocs writes relative links, so the subfolder works either way, but the sitemap and canonical links use site_url.

mkdocs.yml
site_url: https://USERNAME.github.io/REPO/
The full MkDocs on GitHub Pages guide
VitePressdocs/.vitepress/config.mjs

Set base to the repository name, with a slash on both ends.

docs/.vitepress/config.mjs
export default {
  base: '/REPO/',
  // ...title, themeConfig
};
The full VitePress on GitHub Pages guide

Questions

Also asked

Why does it work on my computer?

Your dev server serves the site from the root of localhost, so paths starting at / happen to be right. On GitHub Pages the same paths miss the /REPO/ folder.

Do I need the base path with my own domain?

No. With your own domain the site is at the root again, so remove the base path setting.

Rather skip build settings altogether?

Build on your computer, where it already works, and drop the folder on 99helpers. The site gets its own address, so there's no base path, workflow or build log to get wrong, and it's online in seconds.

Or skip the setup

Drop it in. It's online in seconds.

A file, a folder or a whole site: 99helpers puts it online at its own address, with no git, no build settings and no DNS to start with. Add your own domain whenever you're ready.