Skip to content

Commit

Permalink
fix home button always being selected
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMemeSniper committed Jun 18, 2024
1 parent 70a0ffa commit e3c2ec9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/navBarItem.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
---
const isActive = Astro.url.pathname.startsWith(Astro.props.path)
if (Astro.props.path != "/") {
var isActive = Astro.url.pathname.startsWith(Astro.props.path)
} else {
var isActive = Astro.url.pathname == "/" // fix home always being selected because it's the root
}
interface Props {
page: string
path: string
Expand Down

0 comments on commit e3c2ec9

Please sign in to comment.