diff --git a/astro.config.mjs b/astro.config.mjs index 91b37a7..4d72a78 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,5 +5,6 @@ import tailwind from "@astrojs/tailwind"; // https://astro.build/config export default defineConfig({ site: 'https://globed.dev', + base: '/', integrations: [tailwind()] }); diff --git a/src/components/Button.astro b/src/components/Button.astro index e739ad2..ee83947 100644 --- a/src/components/Button.astro +++ b/src/components/Button.astro @@ -1,6 +1,7 @@ --- const { link, style, solidWidth } = Astro.props; -const url = link.startsWith('https') || link.startsWith('#') ? link : `${import.meta.env.BASE_URL}${link}`; +const urlBase = import.meta.env.BASE_URL.endsWith('/') ? import.meta.env.BASE_URL.slice(0, -1) : import.meta.env.BASE_URL; +const url = link.startsWith('https') || link.startsWith('#') ? link : `${urlBase}${link}`; const classList = `${style} ${Astro.slots.has('post-icon') ? 'has-post-icon' : ''} ${solidWidth === 'true' ? 'is-solid-width' : ''}`; --- diff --git a/src/components/Link.astro b/src/components/Link.astro index f815593..3533f2a 100644 --- a/src/components/Link.astro +++ b/src/components/Link.astro @@ -1,7 +1,8 @@ --- const { href, style, noUnderline } = Astro.props; const classList = `${style} ${noUnderline === 'true' ? 'no-link-underline' : ''}`; -const url = href.startsWith('https') || href.startsWith('#') ? href : `${import.meta.env.BASE_URL}${href}`; +const urlBase = import.meta.env.BASE_URL.endsWith('/') ? import.meta.env.BASE_URL.slice(0, -1) : import.meta.env.BASE_URL; +const url = href.startsWith('https') || href.startsWith('#') ? href : `${urlBase}${href}`; ---