--- export const prerender = false; import PageLayout from "@/layouts/Base.astro"; import LinkCard from "@/components/page/LinkCard.astro"; type Link = { id: number; short_id: string; title: string; url: string; category_id: number; created_at: number; favicon_url?: string | null; }; const meta = { title: "/bookmarks", description: "Links I've saved and want to read", }; let categories: [string, Link[]][] = []; let error: string | null = null; try { const res = await fetch("https://bookmarks.stevedylan.dev/api/links"); if (res.ok) { const data: Record = await res.json(); categories = Object.entries(data).filter(([, links]) => links.length > 0); } else { error = `API returned ${res.status}`; } } catch (e) { error = e instanceof Error ? e.message : "Failed to reach bookmarks API"; } ---

/bookmarks

{error ? (

Could not load bookmarks: {error}

) : categories.length === 0 ? (

no bookmarks yet

) : (
{categories.map(([name, links]) => (

{name}

{links.map((link) => ( ))}
))}
)}