Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto
Something went wrong. Try again.
1.2 kB · 32 lines
TypeScript
123456789101112131415161718192021222324252627282930313233import { defineCollection } from "astro:content";import { glob } from "astro/loaders";// Not astro:content's re-export, which is deprecated.import { z } from "astro/zod";
/** * Updates are markdown files; the schema keeps a frontmatter typo from * shipping as a page with no date on it. * * The field names match what standard.site publishing tools (sequoia) read: * title, description, publishDate, tags, draft. atUri is the reverse * direction — sequoia writes the document record's at:// URI back into the * frontmatter once a post has one, and the layout turns it into a * rel="site.standard.document" link tag. */const posts = defineCollection({ loader: glob({ base: "./src/content/posts", pattern: "**/*.md" }), schema: z.object({ title: z.string(), description: z.string(), publishDate: z.coerce.date(), updatedDate: z.coerce.date().optional(), tags: z.array(z.string()).default([]), draft: z.boolean().default(false),
// Absent until published; a post without one renders no // site.standard.document link rather than an empty href. atUri: z.string().startsWith("at://").optional(), }),});
export const collections = { posts };