-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvelite.config.ts
More file actions
68 lines (65 loc) · 1.93 KB
/
Copy pathvelite.config.ts
File metadata and controls
68 lines (65 loc) · 1.93 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import rehypePrettyCode from "rehype-pretty-code"
import rehypeSlug from "rehype-slug"
import remarkGfm from "remark-gfm"
import { defineCollection, defineConfig, s } from "velite"
const projects = defineCollection({
name: "Project",
pattern: "projects/**/*.mdx",
schema: s
.object({
title: s.string().max(120),
path: s.path(),
description: s.string().max(280),
types: s.array(s.string()).default([]),
tags: s.array(s.string()).default([]),
cover: s.image().optional(),
live: s.string().url().optional(),
github: s.string().url().optional(),
featured: s.boolean().default(false),
order: s.number().default(0),
draft: s.boolean().default(false),
content: s.mdx(),
})
.transform((data) => {
const slug = data.path.replace(/^projects\//, "")
return { ...data, slug }
}),
})
const songs = defineCollection({
name: "Song",
pattern: "songs.yaml",
schema: s.object({
title: s.string(),
artist: s.array(s.string()).min(1),
lyricist: s.string().optional(),
composer: s.string().optional(),
// Vocal range like "G3-E5" (# = +1 semitone, so B#5 parses as C6).
range: s
.string()
.regex(/^[A-G]#?\d-[A-G]#?\d$/, "range must look like G3-E5")
.optional(),
links: s.array(s.string().url()).default([]),
note: s.string().optional(),
status: s.enum(["learned", "learning"]).default("learned"),
}),
})
export default defineConfig({
root: "content",
output: {
data: ".velite",
assets: "public/static",
base: "/static/",
name: "[name]-[hash:6].[ext]",
clean: true,
},
collections: { projects, songs },
mdx: {
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeSlug,
[rehypePrettyCode, { theme: { dark: "github-dark", light: "github-light" } }],
[rehypeAutolinkHeadings, { behavior: "wrap" }],
],
},
})