fix: navbar not showing actual page

Changed files
+12 -3
src
+7 -2
src/components/Navbar.astro
···
---
import Btn from "./NavbarLink.astro"
---
-
<div class="bg-ctp-base w-full pl-8 pr-8 pt-4 pb-4 flex justify-between rounded-bl-2xl rounded-br-2xl">
<div class="flex gap-4 items-center">
<a href="/doodlecat.png"><img src="doodlecat.png" width="48px" height="48px" class="rounded-full" /></a>
-
<span>~/banana/home</span>
</div>
<div class="flex gap-6 items-center">
<Btn page="home"/>
···
---
import Btn from "./NavbarLink.astro"
+
+
let href = Astro.url.toString()
+
href = href.replace(Astro.url.host.toString(), "")
+
href = href.replace("https://", "")
+
href = href.replace("http://", "")
---
+
<div class="absolute bg-ctp-base w-full pl-8 pr-8 pt-4 pb-4 flex justify-between rounded-bl-2xl rounded-br-2xl">
<div class="flex gap-4 items-center">
<a href="/doodlecat.png"><img src="doodlecat.png" width="48px" height="48px" class="rounded-full" /></a>
+
<span>~/banana{href}</span>
</div>
<div class="flex gap-6 items-center">
<Btn page="home"/>
+5 -1
src/components/NavbarLink.astro
···
page: String;
}
const {page} = Astro.props
---
<a
-
href=`/${page}`
class="font-bold
text-ctp-yellow hover:text-ctp-blue
hover:underline
···
page: String;
}
const {page} = Astro.props
+
var href = page
+
if (href == "home") {
+
href = ""
+
}
---
<a
+
href=`/${href}`
class="font-bold
text-ctp-yellow hover:text-ctp-blue
hover:underline