Skip to content
/ deploy-github-pages Public template

Next.js template to deploy to GitHub Pages as a static site.

Notifications You must be signed in to change notification settings

nextjs/deploy-github-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy Next.js to GitHub Pages

This is a Next.js template which can be deployed to GitHub Pages as a static site.

Deploying to GitHub Pages

  1. Create a new public GitHub repository
  2. Edit next.config.ts to match your GitHub repository name:
    • Given the pattern https://github.com/<user>/<repo>
    • Update your basePath config to the name of your repo (e.g. /repo)
  3. Push the starter code to the main branch
  4. Run the deploy script (e.g. npm run deploy) to create the gh-pages branch
  5. On GitHub, go to Settings > Pages > Branch, and choose gh-pages as the branch with the /root folder. Hit Save
  6. Make a change
  7. Run the deploy script again to push the changes to GitHub Pages

Congratulations! You should have a URL like:

https://<github-user-name>.github.io/<github-project-name>/

For more information, see our deployment documentation.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

About

Next.js template to deploy to GitHub Pages as a static site.

Resources

Stars

Watchers

Forks