π» Tech
In Astro, you can create multiple collections by defining it in config.ts
file thatβs one level higher than the collection folders.
For example, suppose we have the following folder structure:
βββ content
β βββ blogs <-- collection 1
β βββ projects <-- collection 2
β βββ config.ts <-- define collections here
Inside config.ts
, the collections are defined and exported. The name of the collection is already the key and the folder name where the markdown files are located.
const blogs = defineCollection({
// ...
});
const projects = defineCollection({
// ...
});
export const collections = { journal, tech };