diff --git a/src/components/HeaderLink.astro b/src/components/HeaderLink.astro index 717cb2e..1fd1b56 100644 --- a/src/components/HeaderLink.astro +++ b/src/components/HeaderLink.astro @@ -1,6 +1,13 @@ --- const { href, class: className, ...props } = Astro.props; -let isActive = href === Astro.url.pathname; +let isActive; + +if (href === "/") { + isActive = Astro.url.pathname === href; +} else { + isActive = Astro.url.pathname.startsWith(href); +} + ---