Skip to content

Commit 64c1dd4

Browse files
committed
Fix examples + tests
1 parent 2b8c39a commit 64c1dd4

File tree

30 files changed

+464
-697
lines changed

30 files changed

+464
-697
lines changed
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { makeSource } from 'contentlayer/source-files'
2+
import 'contentlayer-stackbit-yaml-generator/types'
23

34
import * as documentTypes from './src/contentlayer'
45

56
export default makeSource({
67
contentDirPath: 'content',
78
documentTypes,
8-
extensions: {
9-
stackbit: {
10-
pagesDir: 'content/pages',
11-
dataDir: 'content/data',
12-
},
9+
stackbit: {
10+
pagesDir: 'content/pages',
11+
dataDir: 'content/data',
1312
},
1413
})

examples/archive/playground-azimuth/src/contentlayer/documents/Blog.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ export const Blog = defineDocumentType(() => ({
2323
resolve: urlFromFilePath,
2424
},
2525
},
26-
extensions: {
27-
stackbit: {
28-
fields: {
29-
title: { label: 'Title' },
30-
},
31-
file: 'blog.md',
26+
stackbit: {
27+
fields: {
28+
title: { label: 'Title' },
3229
},
30+
file: 'blog.md',
3331
},
3432
}))

examples/archive/playground-azimuth/src/contentlayer/documents/Config.ts

Lines changed: 55 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,19 @@ export const Config = defineDocumentType(() => ({
4545
// header: { type: 'embedded', model: Header, required: true },
4646
footer: { type: 'nested', of: Footer, required: true },
4747
},
48-
extensions: {
49-
stackbit: {
50-
label: 'Site Configuration',
51-
fields: {
52-
title: { label: 'Title' },
53-
path_prefix: { label: 'Base URL', hidden: true },
54-
domain: { label: 'Domain' },
55-
favicon: { label: 'Favicon' },
56-
palette: { label: 'Color Palette' },
57-
base_font: { label: 'Font' },
58-
header: { label: 'Header Configuration' },
59-
footer: { label: 'Footer Configuration' },
60-
},
61-
file: 'config.json',
62-
},
48+
stackbit: {
49+
label: 'Site Configuration',
50+
fields: {
51+
title: { label: 'Title' },
52+
path_prefix: { label: 'Base URL', hidden: true },
53+
domain: { label: 'Domain' },
54+
favicon: { label: 'Favicon' },
55+
palette: { label: 'Color Palette' },
56+
base_font: { label: 'Font' },
57+
header: { label: 'Header Configuration' },
58+
footer: { label: 'Footer Configuration' },
59+
},
60+
file: 'config.json',
6361
},
6462
}))
6563

@@ -85,15 +83,13 @@ const Header = defineNestedType(() => ({
8583
of: Action,
8684
},
8785
},
88-
extensions: {
89-
stackbit: {
90-
label: 'Header Configuration',
91-
fields: {
92-
logo_img: { label: 'Logo' },
93-
logo_img_alt: { label: 'Logo Alt Text' },
94-
has_nav: { label: 'Enable Navigation' },
95-
nav_links: { label: 'Navigation Links' },
96-
},
86+
stackbit: {
87+
label: 'Header Configuration',
88+
fields: {
89+
logo_img: { label: 'Logo' },
90+
logo_img_alt: { label: 'Logo Alt Text' },
91+
has_nav: { label: 'Enable Navigation' },
92+
nav_links: { label: 'Navigation Links' },
9793
},
9894
},
9995
}))
@@ -127,17 +123,15 @@ const Footer = defineNestedType(() => ({
127123
of: Action,
128124
},
129125
},
130-
extensions: {
131-
stackbit: {
132-
label: 'Footer Configuration',
133-
labelField: 'content',
134-
fields: {
135-
sections: { label: 'Sections' },
136-
has_nav: { label: 'Enable Horizontal Navigation' },
137-
nav_links: { label: 'Horizontal Navigation Links' },
138-
content: { label: 'Footer Content' },
139-
links: { label: 'Links' },
140-
},
126+
stackbit: {
127+
label: 'Footer Configuration',
128+
labelField: 'content',
129+
fields: {
130+
sections: { label: 'Sections' },
131+
has_nav: { label: 'Enable Horizontal Navigation' },
132+
nav_links: { label: 'Horizontal Navigation Links' },
133+
content: { label: 'Footer Content' },
134+
links: { label: 'Links' },
141135
},
142136
},
143137
}))
@@ -196,19 +190,17 @@ const FooterForm = defineNestedType(() => ({
196190
required: true,
197191
},
198192
},
199-
extensions: {
200-
stackbit: {
201-
label: 'Footer Form',
202-
labelField: 'title',
203-
fields: {
204-
...footerSectionBaseFieldsExtension,
205-
content: { label: 'Content' },
206-
form_id: { label: 'Form ID' },
207-
form_action: { label: 'Form Action' },
208-
hide_labels: { label: 'Hide Labels' },
209-
form_fields: { label: 'Form Fields' },
210-
submit_label: { label: 'Submit Button Label' },
211-
},
193+
stackbit: {
194+
label: 'Footer Form',
195+
labelField: 'title',
196+
fields: {
197+
...footerSectionBaseFieldsExtension,
198+
content: { label: 'Content' },
199+
form_id: { label: 'Form ID' },
200+
form_action: { label: 'Form Action' },
201+
hide_labels: { label: 'Hide Labels' },
202+
form_fields: { label: 'Form Fields' },
203+
submit_label: { label: 'Submit Button Label' },
212204
},
213205
},
214206
}))
@@ -223,14 +215,12 @@ const FooterNav = defineNestedType(() => ({
223215
of: Action,
224216
},
225217
},
226-
extensions: {
227-
stackbit: {
228-
label: 'Vertical Navigation',
229-
labelField: 'title',
230-
fields: {
231-
...footerSectionBaseFieldsExtension,
232-
nav_links: { label: 'Vertical Navigation Links' },
233-
},
218+
stackbit: {
219+
label: 'Vertical Navigation',
220+
labelField: 'title',
221+
fields: {
222+
...footerSectionBaseFieldsExtension,
223+
nav_links: { label: 'Vertical Navigation Links' },
234224
},
235225
},
236226
}))
@@ -256,17 +246,15 @@ const FooterText = defineNestedType(() => ({
256246
description: 'The text content of the section',
257247
},
258248
},
259-
extensions: {
260-
stackbit: {
261-
label: 'Text',
262-
labelField: 'title',
263-
fields: {
264-
...footerSectionBaseFieldsExtension,
265-
image: { label: 'Image' },
266-
image_alt: { label: 'Image Alt Text' },
267-
image_url: { label: 'Image URL' },
268-
content: { label: 'Content' },
269-
},
249+
stackbit: {
250+
label: 'Text',
251+
labelField: 'title',
252+
fields: {
253+
...footerSectionBaseFieldsExtension,
254+
image: { label: 'Image' },
255+
image_alt: { label: 'Image Alt Text' },
256+
image_url: { label: 'Image URL' },
257+
content: { label: 'Content' },
270258
},
271259
},
272260
}))

0 commit comments

Comments
 (0)