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
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
Links in hand-written HTML start with a slash
How to tell: Your HTML has links like
href="/style.css"orsrc="/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
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
_nextor_app, return 404.Fix
Add an empty file named
.nojekyllat the top of the published folder. Or publish with a GitHub Actions workflow, which doesn't run Jekyll at all. - 4
A file name differs in capitals
How to tell: One image or stylesheet is missing, and its name has capitals:
Logo.PNGon disk,logo.pngin 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
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.
import { defineConfig } from 'astro/config';
export default defineConfig({
site: 'https://USERNAME.github.io',
base: '/REPO',
});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.
import { defineConfig } from 'vite';
export default defineConfig({
base: '/REPO/',
// keep your plugins (react(), vue(), svelte()...) here
});Hugoin the workflow
Nothing to change: the workflow passes the right baseURL to Hugo when it builds.
SvelteKitvite.config.js
Give the adapter a 404.html fallback and read the base path from the BASE_PATH variable the workflow sets.
sveltekit({
adapter: adapter({ fallback: '404.html' }),
paths: { base: process.env.BASE_PATH ?? '' },
}),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.
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.
url: 'https://USERNAME.github.io',
baseUrl: '/REPO/',
organizationName: 'USERNAME',
projectName: 'REPO',
trailingSlash: false,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.
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.
const nextConfig = {
output: 'export',
images: { unoptimized: true },
basePath: '/REPO',
};Gatsbygatsby-config.js
Add a pathPrefix with the repository name. The workflow builds with --prefix-paths so Gatsby uses it.
module.exports = {
pathPrefix: '/REPO',
// ...your siteMetadata and plugins
};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 }}.
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.
Create React Apppackage.json
Add a homepage field to package.json with the full address, so the build points at /REPO/.
"homepage": "https://USERNAME.github.io/REPO",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.
site_url: https://USERNAME.github.io/REPO/VitePressdocs/.vitepress/config.mjs
Set base to the repository name, with a slash on both ends.
export default {
base: '/REPO/',
// ...title, themeConfig
};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.