File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ type Props = {
55
66const { currentPath } = Astro .props ;
77
8+ // Normalize paths by removing trailing slashes for comparison
9+ const normalizedCurrentPath = currentPath .replace (/ \/ $ / , ' ' ) || ' /' ;
10+
811const 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 }
You can’t perform that action at this time.
0 commit comments