Deploy to GitHub pages
GitHub Pages allows you to deploy your site to GitHub's free static site hosting service.
There's a few steps to complete:
yarn add gh-pagesor
npm i gh-pages
- Add the following to
siteUrl: 'https://<your-github-username>.github.io', pathPrefix: '/<your-gridsome-repo-name>',
- Add the following scripts to your
"predeploy": "npm run build", "deploy": "gh-pages -d dist"
- Run the command
npm run deploy
- Go to GitHub's website and make sure your Repo's settings under "GitHub Pages" show the
gh-pagesbranch under "Source".
GitHub Pages allows you to have a "Github user page" that acts as a profile/main page on
<your-github-username>.github.io by having a repo named
If you are deploying to your GitHub user page (your main site on
Make the following adjustments to your
- "deploy": "gh-pages -d dist", + "deploy": "gh-pages -b master -d dist",
And Remove this line from
- pathPrefix: '/<your-gridsome-repo-name>',
If you are using a custom URL such as
www.yourname.comyou will need to change
If you are using an apex domain for your GitHub user page (ie.
https://yourname.compoints to all of your GitHub Pages sites), and your Gridsome project is not your GitHub user page (not on the root
https://yourname.compage, but a separate repo), then you will need to make sure
pathPrefixmatches your gridsome project's repo name in