-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Astro Info
Astro version v2.9.6
Package manager npm
Platform darwin
Architecture arm64
Adapter Couldn't determine.
Integrations @astrojs/react, @astrojs/tailwind, auto-import, @astrojs/mdx
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I'm well aware some might see this as a new feature, but I have to disagree. Content collections should be able to handle a "empty state" – meaning you should be able to use a content collection which has no items. Currently, this will always throw an error, so the page basically breaks. But there are plenty valid use cases for empty collections and it should be possible to still use the site (e.g. throw a warning instead of an error).
Also the error is technically not correct. This is what it says:
error The collection examples does not exist. Ensure a collection directory with this name exists.
Yet, this is also the error, when the folder exists, but there's just no file in it.
Am I missing something or is this really an oversight in the concept of content collections?
What's the expected result?
Page should still render
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-agpp3a?file=src%2Fpages%2Findex.astro
Participation
- I am willing to submit a pull request for this issue.