Skip to content

Commit b0684eb

Browse files
committed
Turn off legacy.collections and define src/content.config.ts
camelcase
1 parent 8e411ac commit b0684eb

File tree

4 files changed

+68
-5
lines changed

4 files changed

+68
-5
lines changed

astro.config.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ export default defineConfig({
2626
start_url: "/",
2727
}
2828
})],
29-
legacy: {
30-
collections: true, // TODO: migrate to Content Layer API
31-
},
3229
markdown: {
3330
shikiConfig: {
3431
theme: syntaxTheme,

src/content.config.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { defineCollection, z } from 'astro:content';
2+
import { glob } from 'astro/loaders';
3+
4+
const blog = defineCollection({
5+
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: './src/content/blog' }),
6+
});
7+
8+
const community = defineCollection({
9+
loader: glob({ pattern: '**/[^_]*.yaml', base: './src/content/community' }),
10+
});
11+
12+
const download = defineCollection({
13+
loader: glob({
14+
pattern: '**/[^_]*.{md,mdx}',
15+
base: './src/content/download',
16+
}),
17+
});
18+
19+
const explore = defineCollection({
20+
loader: glob({ pattern: '**/[^_]*.yaml', base: './src/content/explore' }),
21+
});
22+
23+
const landing = defineCollection({
24+
loader: glob({ pattern: '**/[^_]*.yaml', base: './src/content/landing' }),
25+
});
26+
27+
const landingFeatures = defineCollection({
28+
loader: glob({
29+
pattern: '**/[^_]*.{md,mdx}',
30+
base: './src/content/landing-features',
31+
}),
32+
});
33+
34+
const learningManuals = defineCollection({
35+
loader: glob({
36+
pattern: '**/[^_]*.{md,mdx}',
37+
base: './src/content/learning-manuals',
38+
}),
39+
});
40+
41+
const menus = defineCollection({
42+
loader: glob({ pattern: '**/[^_]*.yaml', base: './src/content/menus' }),
43+
});
44+
45+
// TODO get `research` from astro collection instead of hardcoded json
46+
47+
const sponsors = defineCollection({
48+
loader: glob({ pattern: '**/[^_]*.yaml', base: './src/content/sponsors' }),
49+
});
50+
51+
const teams = defineCollection({
52+
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: './src/content/teams' }),
53+
});
54+
55+
export const collections = {
56+
blog,
57+
community,
58+
download,
59+
explore,
60+
landing,
61+
landingFeatures,
62+
learningManuals,
63+
menus,
64+
sponsors,
65+
teams,
66+
};

src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Asciinema from '../components/ui/Asciinema.astro';
1010
import Banner from '../components/ui/Banner.astro';
1111
import InlineSVG from '../components/util/InlineSVG.astro';
1212
13-
const landingFeatures = await getCollection('landing-features');
13+
const landingFeatures = await getCollection('landingFeatures');
1414
const demos = await getEntry('landing', 'demos');
1515
const posts = await getCollection('blog');
1616
posts

src/pages/learn.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Button from '../components/ui/Button.astro';
77
import NixosSearchInput from '../components/ui/NixosSearchInput.astro';
88
import InlineSVG from '../components/util/InlineSVG.astro';
99
import Layout from '../layouts/Layout.astro';
10-
const learningManuals = await getCollection('learning-manuals');
10+
const learningManuals = await getCollection('learningManuals');
1111
1212
const learningFeatures = [
1313
{

0 commit comments

Comments
 (0)