feat(docs-site): scaffold Astro Starlight site
Scaffold docs/site/ via `npm create astro@latest ... --template starlight`. Extend the docs collection schema in src/content.config.ts with the four custom frontmatter fields (man, site, manTitle, helpKeywords) needed by the generator in a later task, using z.strictObject so unrecognized keys fail the build instead of being silently stripped by Zod's default behavior. Ignore generated site output (node_modules, dist, .astro, generated content, and sidebar.json) in .gitignore.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
@@ -0,0 +1,25 @@
|
||||
import { defineCollection } from 'astro:content';
|
||||
import { z } from 'astro/zod';
|
||||
import { docsLoader } from '@astrojs/starlight/loaders';
|
||||
import { docsSchema } from '@astrojs/starlight/schema';
|
||||
|
||||
export const collections = {
|
||||
docs: defineCollection({
|
||||
loader: docsLoader(),
|
||||
schema: docsSchema({
|
||||
// z.strictObject (not z.object) so that Zod v4's default key-stripping
|
||||
// doesn't silently swallow typos in generated frontmatter — an unknown
|
||||
// key like `bogusField` must fail the build, not disappear quietly.
|
||||
extend: z.strictObject({
|
||||
// Include this page in the generated man page.
|
||||
man: z.boolean().default(true),
|
||||
// Publish this page to the website.
|
||||
site: z.boolean().default(true),
|
||||
// Verbatim heading text used by the man page renderer.
|
||||
manTitle: z.string().optional(),
|
||||
// Keywords resolving to this page via `help config <keyword>`.
|
||||
helpKeywords: z.array(z.string()).default([]),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user