feat(site): prefetch all links

This commit is contained in:
Darius Cepulis
2025-10-30 08:34:47 -05:00
parent bd6ef02282
commit bd9fd38aa4
5 changed files with 15 additions and 17 deletions
+2 -5
View File
@@ -10,16 +10,14 @@ export interface Props {
class?: string;
}
export type NavLink = {
type NavLink = {
href: string;
label: string;
matchPath: string | null;
external?: boolean;
prefetch?: boolean;
};
const navLinks: NavLink[] = [
// docs require a redirect, so, let's prefetch them to hide that latency
{ href: '/docs', label: 'Docs', matchPath: '/docs', prefetch: true },
{ href: '/docs', label: 'Docs', matchPath: '/docs' },
// { href: '/blog', label: 'Blog', matchPath: '/blog' },
];
@@ -53,7 +51,6 @@ const { class: className, dark = false } = Astro.props;
: 'border-transparent intent:border-current',
]}
aria-current={link.matchPath && currentPath.startsWith(link.matchPath) ? 'page' : undefined}
data-astro-prefetch={link.prefetch ? '' : undefined}
>
{link.label} {link.external ? <ArrowUpRight size="1em" /> : null}
</a>