Template (Blog): fix HeaderLink
isActive
check (#4647)
* remove trailing slashes when checking active href * use simpler regex Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * remove unused code Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
parent
013d15554e
commit
234057b020
1 changed files with 1 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
|||
export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}
|
||||
|
||||
const { href, class: className, ...props } = Astro.props;
|
||||
const isActive = href === Astro.url.pathname;
|
||||
const isActive = href === Astro.url.pathname.replace(/\/$/, '');
|
||||
---
|
||||
|
||||
<a href={href} class:list={[className, { active: isActive }]} {...props}>
|
||||
|
|
Loading…
Reference in a new issue