More AI
This commit is contained in:
parent
f3fc893675
commit
bb5b4c4cf3
43 changed files with 585 additions and 524 deletions
|
|
@ -3,28 +3,28 @@ import { navItems, site } from '../lib/site';
|
|||
|
||||
const current = Astro.url.pathname;
|
||||
|
||||
function isCurrent(href: string) {
|
||||
if (href === '/') return current === '/';
|
||||
return current.startsWith(href);
|
||||
// Exact match for the current page; section match (descendant URLs) for
|
||||
// ancestor links. `aria-current="page"` is reserved for the exact page,
|
||||
// `"true"` indicates an ancestor section.
|
||||
function currentState(href: string): 'page' | 'true' | undefined {
|
||||
if (current === href) return 'page';
|
||||
if (href !== '/' && current.startsWith(href)) return 'true';
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Local fallback: Agent 3 hasn't shipped `footerItems`/`footerOnly` yet, so we
|
||||
// derive header items locally. Header shows nav (minus Home) + Tags. RSS lives
|
||||
// in the header as a dedicated icon link.
|
||||
const headerNavItems = [
|
||||
...navItems.filter((item) => item.href !== '/'),
|
||||
{ href: '/tags/', label: 'Tags' },
|
||||
];
|
||||
// Header shows nav items except Home and footer-only entries. RSS lives as a
|
||||
// dedicated icon link to the right of the nav.
|
||||
const headerNavItems = navItems.filter((item) => item.href !== '/' && !item.footerOnly);
|
||||
---
|
||||
|
||||
<a class="skip-link" href="#content">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<a class="site-title" href="/">{site.name}</a>
|
||||
<a class="site-title" href="/" aria-current={currentState('/')}>{site.name}</a>
|
||||
<div class="header-actions">
|
||||
<nav class="site-nav" aria-label="Primary">
|
||||
{
|
||||
headerNavItems.map((item) => (
|
||||
<a href={item.href} aria-current={isCurrent(item.href) ? 'page' : undefined}>
|
||||
<a href={item.href} aria-current={currentState(item.href)}>
|
||||
{item.label}
|
||||
</a>
|
||||
))
|
||||
|
|
@ -112,8 +112,15 @@ const headerNavItems = [
|
|||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-block-size: 44px;
|
||||
min-inline-size: 44px;
|
||||
color: inherit;
|
||||
line-height: 0;
|
||||
transition: color 150ms ease;
|
||||
}
|
||||
.rss-link:hover,
|
||||
.rss-link:focus-visible {
|
||||
color: var(--color-link-hover);
|
||||
}
|
||||
.rss-icon {
|
||||
display: block;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue