From dbcaf6c4cc2437717741f20431c6ce480477ca42 Mon Sep 17 00:00:00 2001
From: HJfod <60038575+HJfod@users.noreply.github.com>
Date: Tue, 5 Mar 2024 00:20:09 +0200
Subject: [PATCH] this should fix the url issues
---
astro.config.mjs | 1 +
src/components/Button.astro | 3 ++-
src/components/Link.astro | 3 ++-
src/components/Navbar.astro | 23 ++++++++++-------------
src/layouts/Default.astro | 12 ++++++------
5 files changed, 21 insertions(+), 21 deletions(-)
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}`;
---