aboutsummaryrefslogtreecommitdiff
path: root/src/content.config.ts
blob: acaaf8a67fdc285ad68c91438546d633f620060b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { glob } from "astro/loaders";
import { defineCollection, z } from "astro:content";

const blog = defineCollection({
  loader: glob({ pattern: "**/*.{md,mdx}", base: "src/data/blog" }),
  schema: z.object({
    title: z.string(),
    description: z.string(),
    publishedAt: z.coerce.date(),
    tags: z.array(z.string()).default([]),
  }),
});

const portfolio = defineCollection({
  loader: glob({ pattern: "**/*.{md,mdx}", base: "src/data/portfolio" }),
  schema: z.object({
    title: z.string(),
    description: z.string(),
    technologies: z.array(z.string()),
    githubLink: z.string().url().optional(),
    onlineLink: z.string().url().optional(),
    demoLink: z.string().url().optional(),
    images: z.array(
      z.object({ src: z.string(), alt: z.string() })
    ).default([])
  }),
});

export const collections = {
  blog,
  portfolio,
};