#Deploy in GitHub pages

2 messages · Page 1 of 1 (latest)

slender lionBOT
#

Hi @void nebula. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To deploy your Astro site to GitHub Pages, you need to set the site and base options in your astro.config.mjs file.

The site option should be set to your GitHub Pages URL. This will typically be in the format <https://<username>.github.io.>

The base option should be set to your repository name, prefixed with a forward slash. This is so that Astro understands your website’s root is /my-repo, rather than the default /.

Here's an example:

import { defineConfig } from 'astro/config'
export default defineConfig({  
  site: '<https://<username>.github.io',>  
  base: '/<my-repo>',
})

Replace <username> with your GitHub username and <my-repo> with your repository name.

Please note that you should not set a base parameter if your page is served from the root folder or if your repository is located at <https://github.com/<USERNAME>/<USERNAME>.github.io.>

Also, when the base value is configured, all of your internal page links must be prefixed with your base value. For example:

<a href="/my-repo/about">About</a>

For more information, you can refer to the Astro documentation on deploying to GitHub Pages (https://docs.astro.build/en/guides/deploy/github/#configure-astro-for-github-pages).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: