content.config.ts 562 B

12345678910111213141516
  1. import { defineCollection, z } from "astro:content"
  2. import { docsLoader, i18nLoader } from "@astrojs/starlight/loaders"
  3. import { docsSchema, i18nSchema } from "@astrojs/starlight/schema"
  4. import en from "./content/i18n/en.json"
  5. const custom = Object.fromEntries(Object.keys(en).map((key) => [key, z.string()]))
  6. export const collections = {
  7. docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
  8. i18n: defineCollection({
  9. loader: i18nLoader(),
  10. schema: i18nSchema({
  11. extend: z.object(custom).catchall(z.string()),
  12. }),
  13. }),
  14. }