import { defineCollection, z } from "astro:content"; import { docsLoader } from "@astrojs/starlight/loaders"; import { docsSchema } from "@astrojs/starlight/schema"; // The docs content collection every Norsk product site declares. Shared so a // page authored for one site is loadable by another and the guide renderer has // one schema to satisfy. // // `capturedAgainst` is what the test-driven guides' renderer writes into a // generated page's front matter (`renderMarkdown` in the shared guide // renderer): the versions the page was captured against and the capture date. // Footer.astro renders it; a hand-written page simply has none. Strings, not // dates — the renderer quotes them for exactly that reason. export const capturedAgainstSchema = z.object({ norsk: z.string().optional(), norskMgr: z.string().optional(), when: z.string(), }); export const collections = { docs: defineCollection({ loader: docsLoader(), schema: docsSchema({ extend: z.object({ capturedAgainst: capturedAgainstSchema.optional() }) }), }), };