Hey Kapa.
i'm trying to visit my "projects" collection from pages/gallery.astro but I'm getting the error "The collection "projects" does not exist or is empty. Please check your content config file for errors."
My data collection is inside src/portfolio, with pages listed post1.md, post2.md and so on
My src/content.config.cjs is set up like so:
import { glob } from 'astro/loaders';
const projects = defineCollection({
loader: glob({pattern: "**/*.md", base: "src/portfolio"}),
schema : z.object({
title: z.string(),
description: z.string().optional(),
summary: z.string().optional(),
date: z.date(),
weight: z.number(),
featured_image: z.url(),
}),
});
export const collections = { projects };```
my pages/gallery.astro is set up like so
```const pageTitle = "Portfolio";
const allPosts = await getCollection("projects");
console.log(allPosts);```
A typical markdown page in src/portfolio looks like so:
```---
title: "Test"
date: 2023-12-06
draft: false
language: en
summary: test.
description: Commission for john doe.
featured_image: ../assets/images/posts/post1.png
params:
customer: john doe
weight: 01
---
Why is Astro not picking up the collection?