- Install dependencies:
npm install
- Configure base path (GitHub Pages):
- For a repo site (https://username.github.io/repo-name), set:
NEXT_PUBLIC_BASE_PATH=/repo-name
- For a user/organization site (https://username.github.io), set:
NEXT_PUBLIC_BASE_PATH=
- For a repo site (https://username.github.io/repo-name), set:
npm run devTo simulate GitHub Pages paths locally:
NEXT_PUBLIC_BASE_PATH=/repo-name npm run devnpm run buildThe static output is generated in out/.
This repo includes a workflow at .github/workflows/deploy.yml that builds and deploys the out/ folder.
- In your GitHub repository, go to Settings → Pages.
- Set Source to GitHub Actions.
- Set the base path for the workflow:
- Go to Settings → Secrets and variables → Actions → Variables.
- Create a variable named
NEXT_PUBLIC_BASE_PATH. - For repo pages:
/repo-name. - For user pages: leave it empty.
Push to main to trigger deployment.