astrowind icon indicating copy to clipboard operation
astrowind copied to clipboard

Highlight of current page in Header with trailing slash broken

Open g012 opened this issue 1 year ago • 0 comments

Hello,

Using site option trailingSlash, I believe there is a mistake in Header.astro at this line:

const currentPath = `/${trimSlash(new URL(Astro.url).pathname)}`;

Later in the page there is this code:

                    { 'aw-link-active': href === currentPath },

But href is built in navigation.ts, using this code:

      href: getPermalink('/contact'),

So getPermalink and trimSlash do not return the same value, for 'contact, getPermalink will return '/contact/', but the 'trimSlash' line will return '/contact'. I believe 'currentPath' sould be built the same as navigation.ts:

const currentPath = `${getPermalink(new URL(Astro.url).pathname)}`;

g012 avatar Nov 23 '24 15:11 g012