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-pages or
npm i gh-pages
Add the following to
siteUrl: 'https://<your-github-username>.github.io', pathPrefix: '/<your-gridsome-repo-name>',
"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-pages branch 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
- pathPrefix: '/<your-gridsome-repo-name>',
npm run deploycommand, your project will be built and the contents of the
distfolder will be pushed to the
gh-pagesbranch which is where your "GitHub user page" will deploy from.
masterbranch (or any branch you want) while
gh-pagesonly contains your built files.
www.yourname.comyou will need to change
/staticto avoid a known issue in GitHub Pages that results in the deployment incorrectly overwriting the custom domain setting within GitHub user settings.
// CNAME custom.domain.com
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