Allow for empty content collections #8336
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
feat: content collections
Related to the Content Collections feature (scope)
Astro Info
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:
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
The text was updated successfully, but these errors were encountered: