summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/content.config.ts
blob: 2ed34e4c3d5054104bf2a43e0e028795db48e8df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { defineCollection, z } from "astro:content"
import { docsLoader, i18nLoader } from "@astrojs/starlight/loaders"
import { docsSchema, i18nSchema } from "@astrojs/starlight/schema"
import en from "./content/i18n/en.json"

const custom = Object.fromEntries(Object.keys(en).map((key) => [key, z.string()]))

export const collections = {
  docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
  i18n: defineCollection({
    loader: i18nLoader(),
    schema: i18nSchema({
      extend: z.object(custom).catchall(z.string()),
    }),
  }),
}