How to Deploy to GitHub Pages
Deploying to GitHub Pages
This blog is ready to be deployed to GitHub Pages. Here is how you can do it.
Steps
- Create a new repository on GitHub.
- Push this code to the repository.
- Go to Settings > Pages.
- Source: GitHub Actions.
- GitHub will detect the Astro project and suggest a workflow.
Configuration
If you are deploying to a user site (username.github.io), set site in astro.config.mjs:
export default defineConfig({
site: 'https://username.github.io',
// ...
});
If deploying to a project site (username.github.io/repo), set base as well:
export default defineConfig({
site: 'https://username.github.io',
base: '/repo',
});