fix: normalize both nav urls before comparing

This commit is contained in:
Cory Dransfeldt 2024-11-28 21:01:28 -08:00
parent ef133b7dca
commit a7e0b36d82
No known key found for this signature in database
2 changed files with 13 additions and 4 deletions

View file

@ -1,10 +1,10 @@
---
import IconMapper from "@components/IconMapper.astro";
import { removeTrailingSlash } from "@utils/helpers/general.js";
import { normalizePath } from "@utils/helpers/general.js";
const { url, title, icon } = Astro.props;
const isHttp = url?.startsWith("http");
const isActive = Astro.url.pathname === removeTrailingSlash(url);
const isActive = normalizePath(Astro.url.pathname) === normalizePath(url);
---
{