diff --git a/src/lib/components/Navbar/Navbar.svelte b/src/lib/components/Navbar/Navbar.svelte index b415f63..faba6cf 100644 --- a/src/lib/components/Navbar/Navbar.svelte +++ b/src/lib/components/Navbar/Navbar.svelte @@ -9,12 +9,21 @@ import Button from '../ui/button/button.svelte' import { Moon, Sun } from 'svelte-radix' - let current: 'blog' | 'about' | 'home' | 'portfolio' | string + let current: 'blogpost' | 'blog' | 'about' | 'home' | 'portfolio' | string const updateCurrent = () => { const path = window.location.pathname - if (path === '/') { - current = 'home' + // if (path === '/') { + // current = 'home' + // } else { + // const segments = path.split('/') + // current = segments[1] || 'home' + // } + + if (path === '/blog') { + current = 'blog' + } else if (path.startsWith('/blog')) { + current = 'blogpost' } else { const segments = path.split('/') current = segments[1] || 'home' @@ -24,10 +33,14 @@ onMount(() => navigating.subscribe(updateCurrent)) -