summaryrefslogtreecommitdiff
path: root/examples/blog/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/blog/src')
-rw-r--r--examples/blog/src/components/HeaderLink.astro4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/blog/src/components/HeaderLink.astro b/examples/blog/src/components/HeaderLink.astro
index d82155c62..e8e2e103b 100644
--- a/examples/blog/src/components/HeaderLink.astro
+++ b/examples/blog/src/components/HeaderLink.astro
@@ -2,7 +2,9 @@
export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}
const { href, class: className, ...props } = Astro.props;
-const isActive = href === Astro.url.pathname.replace(/\/$/, '');
+
+const { pathname } = Astro.url;
+const isActive = href === pathname || href === pathname.replace(/\/$/, '');
---
<a href={href} class:list={[className, { active: isActive }]} {...props}>