Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight of current page in Header with trailing slash broken #557

Open
g012 opened this issue Nov 23, 2024 · 0 comments
Open

Highlight of current page in Header with trailing slash broken #557

g012 opened this issue Nov 23, 2024 · 0 comments

Comments

@g012
Copy link

g012 commented Nov 23, 2024

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)}`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant