-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentlayer.config.js
More file actions
161 lines (149 loc) · 5.01 KB
/
contentlayer.config.js
File metadata and controls
161 lines (149 loc) · 5.01 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import {
defineDocumentType,
defineNestedType,
makeSource,
} from "contentlayer/source-files";
// Type Site contains information about the website, such as: the title of the
// website, a description, an associated image, among others.
export const Site = defineDocumentType(() => ({
name: "Site",
description:
"Type Site contains information about the website, such as the title and a description of the website.",
contentType: "data",
filePathPattern: "/config/site.yaml",
isSingleton: true,
fields: {
title: { type: "string", required: true },
description: { type: "string", required: true },
baseUrl: { type: "string", required: true },
languageCode: { type: "string", required: true },
},
}));
// Type Menu contains information about the website menu and its entries,
// including their label and link.
export const Menu = defineDocumentType(() => ({
name: "Menu",
description:
"Type Menu contains information about the website menu and its entries, including their label and link.",
contentType: "data",
filePathPattern: "/config/menu.yaml",
isSingleton: true,
fields: {
title: { type: "string", required: false },
entries: { type: "list", of: Link, required: true },
},
}));
const Link = defineNestedType(() => ({
name: "Link",
fields: {
label: { type: "string", required: true },
link: { type: "string", required: false },
blank: { type: "boolean", required: false },
},
}));
// Type Hero contains information about the website Hero section.
export const Hero = defineDocumentType(() => ({
name: "Hero",
description: "Type Hero contains information about the website Hero section.",
contentType: "data",
filePathPattern: "/data/hero.yaml",
isSingleton: true,
fields: {
title: { type: "string", required: true },
lead: { type: "string", required: true },
backgroundImage: { type: "string", required: true },
},
}));
// Type History contains information about the website History section.
export const History = defineDocumentType(() => ({
name: "History",
description:
"Type History contains information about the website History section.",
contentType: "data",
filePathPattern: "/data/history.yaml",
isSingleton: true,
fields: {
pretitle: { type: "string", required: true },
title: { type: "string", required: true },
text: { type: "string", required: true },
image: { type: "string", required: true },
},
}));
// Type About contains information about the website About section.
export const About = defineDocumentType(() => ({
name: "About",
description:
"Type About contains information about the website About section.",
contentType: "data",
filePathPattern: "/data/about.yaml",
isSingleton: true,
fields: {
pretitle: { type: "string", required: true },
title: { type: "string", required: true },
text: { type: "string", required: true },
image: { type: "string", required: true },
brands: { type: "nested", of: Brands, required: true },
},
}));
const Brands = defineNestedType(() => ({
name: "Brands",
fields: {
title: { type: "string", required: true },
items: { type: "list", of: Brand, required: true },
},
}));
const Brand = defineNestedType(() => ({
name: "Brand",
fields: {
label: { type: "string", required: true },
image: { type: "string", required: true },
},
}));
// Type Services contains information about the website Services section.
export const Services = defineDocumentType(() => ({
name: "Services",
description:
"Type Services contains information about the website Services section.",
contentType: "data",
filePathPattern: "/data/services.yaml",
isSingleton: true,
fields: {
pretitle: { type: "string", required: true },
title: { type: "string", required: true },
text: { type: "string", required: true },
image: { type: "string", required: true },
},
}));
// Type Footer contains information about the website Footer section.
export const Footer = defineDocumentType(() => ({
name: "Footer",
description:
"Type Footer contains information about the website Footer section.",
contentType: "data",
filePathPattern: "/data/footer.yaml",
isSingleton: true,
fields: {
menu: { type: "nested", of: Menu, required: true },
hours: { type: "nested", of: Menu, required: true },
location: { type: "nested", of: Menu, required: true },
copyright: { type: "nested", of: Menu, required: true },
},
}));
// Type Contact contains information about the website Contact page.
export const Contact = defineDocumentType(() => ({
name: "Contact",
description:
"Type Contact contains information about the website Contact section.",
contentType: "data",
filePathPattern: "/data/contact.yaml",
isSingleton: true,
fields: {
pretitle: { type: "string", required: true },
title: { type: "string", required: true },
text: { type: "string", required: true },
},
}));
export default makeSource({
contentDirPath: "content",
documentTypes: [Site, Menu, Hero, History, About, Services, Footer, Contact],
});