Skip to content

Commit 9cbf598

Browse files
committed
Fix base path for GitHub Pages deploy
Update the Astro site base to `/launchpad` for GitHub Pages hosting, and make the language picker prepend the configured base path so locale links resolve correctly under the project subpath.
1 parent 17b8ec9 commit 9cbf598

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import icon from "astro-icon";
1212
// https://astro.build/config
1313
export default defineConfig({
1414
site: "https://roicort.github.io",
15-
base: "/",
15+
base: "/launchpad",
1616
integrations: [mdx(), sitemap(), pagefind(), icon()],
1717

1818
vite: {

src/components/LanguagePicker.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import { languages } from '../i18n/ui';
33
import { getLangFromUrl, useTranslatedPath } from '../i18n/utils';
4+
import { withBase } from '../utils/slugify';
45
56
const lang = getLangFromUrl(Astro.url);
67
const translatePath = useTranslatedPath(lang);
@@ -24,7 +25,7 @@ const currentLabel = languages[lang];
2425
'language-picker__option',
2526
isCurrent && 'language-picker__option--active',
2627
]}
27-
href={translatePath('/', l)}
28+
href={withBase(translatePath('/', l))}
2829
aria-current={isCurrent ? 'page' : undefined}
2930
>
3031
<span class="language-picker__option-code" aria-hidden="true">{l.toUpperCase()}</span>

0 commit comments

Comments
 (0)