Skip to content

Commit d5f514b

Browse files
committed
Fix: remove trailing slashes
1 parent 4ce4fbb commit d5f514b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/components/Navigation.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ type Props = {
55
66
const { currentPath } = Astro.props;
77
8+
// Normalize paths by removing trailing slashes for comparison
9+
const normalizedCurrentPath = currentPath.replace(/\/$/, '') || '/';
10+
811
const NAVIGATION_ITEMS = [
912
{ link: '/', title: 'Home' },
1013
{ link: '/about', title: 'About' },
@@ -24,7 +27,7 @@ const NAVIGATION_ITEMS = [
2427
<a
2528
href={item.link}
2629
class={`font-light uppercase hover:text-indigo-600 my-8 border-indigo-600 transition-colors duration-200 ${
27-
currentPath === item.link ? 'text-indigo-600 border-b-2 pb-2' : ''
30+
normalizedCurrentPath === item.link ? 'text-indigo-600 border-b-2 pb-2' : ''
2831
}`}
2932
>
3033
{item.title}
@@ -64,7 +67,7 @@ const NAVIGATION_ITEMS = [
6467
href={item.link}
6568
onclick="closeMobileMenu()"
6669
class={`font-light uppercase hover:text-indigo-600 my-8 border-indigo-600 transition-colors duration-200 ${
67-
currentPath === item.link ? 'text-indigo-600 border-b-2 pb-2' : ''
70+
normalizedCurrentPath === item.link ? 'text-indigo-600 border-b-2 pb-2' : ''
6871
}`}
6972
>
7073
{item.title}

0 commit comments

Comments
 (0)