summaryrefslogtreecommitdiff
path: root/src/content.config.ts
blob: 821faf51be28d52297cb5ceffe01f50b4ed5c2f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { file, glob } from "astro/loaders";
import { defineCollection, type z } from "astro:content";
//import { parse } from "@std/toml";
import { parse } from "toml";
import { Blog, Entity } from "./lib/collection/schemas.ts";

const blog = defineCollection({
  loader: glob({ base: "./public/blog", pattern: "+([0-9a-z-]).md" }),
  schema: Blog,
});

const entity = defineCollection({
  loader: file("./src/content/entities.toml", {
    parser: (text) => parse(text).entities as z.infer<typeof Entity>[],
  }),
  schema: Entity,
});

export const collections = { blog, entity };