Repository Public MIT
1import type { MetadataRoute } from "next";2import { listDocs } from "@/lib/content";3import { makeCtx } from "@/server/context";4import { env } from "@/server/env";56export const dynamic = "force-dynamic";78export default async function sitemap(): Promise<MetadataRoute.Sitemap> {9 const ctx = makeCtx();10 const base = env.publicUrl;11 const arts = await ctx.sql<{ namespace: string; slug: string; updated_at: Date }[]>`SELECT namespace, slug, updated_at FROM artifacts WHERE visibility = 'public' AND state IN ('active','deprecated') ORDER BY updated_at DESC LIMIT 5000`;12 const cols = await ctx.sql<{ slug: string }[]>`SELECT slug FROM collections`;13 return [14 ...["", "/explore", "/skills", "/mcp-servers", "/agents", "/workflows", "/collections", "/publish", "/about", "/contact"].map((p) => ({ url: base + p })),15 ...listDocs().map((d) => ({ url: `${base}/docs${d.slug === "index" ? "" : `/${d.slug}`}` })),16 ...cols.map((c) => ({ url: `${base}/collections/${c.slug}` })),17 ...arts.map((a) => ({ url: `${base}/@${a.namespace}/${a.slug}`, lastModified: a.updated_at })),18 ];19}20