--- const navItems = [ { href: '/', label: '首页', match: 'index' }, { href: '/posts', label: '文章', match: 'posts' }, { href: '/tags', label: '标签', match: 'tags' }, { href: '/archives', label: '归档', match: 'archives' }, { href: '/about', label: '关于', match: 'about' }, ]; const path = Astro.url.pathname.replace(/\/+$/, '').replace(/^\//, ''); const current = path === '' ? 'index' : path.split('/')[0]; ---