-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File Loader API unclear #11027
Comments
Would the wording below have been clearer? The file() loader creates entries from a single file that contains an array of objects with a unique id field, or an object with IDs as keys and entries as values. Or, maybe we need to be a bit more verbose and replace what we currently have with something like:
|
Personally I think the first would be just fine, that makes it very clear to me I'll mention it to the user that I was working with on this too and have them comment if they get a chance 👍 |
I am experiencing this coming from v4, there is no mention in the migration guide as far as I can see: https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections A short example of how this should look would go a long way, I assumed that I could port and existing file collection to v5 without issue. Even after changing the shape of the file to use string key + object value, I am not able to use this feature successfully. |
Hi @Fermain! You're right, the migration guide doesn't show how to use the The
This is the same as an If you're on Discord, do not hesitate to create a support thread so someone can help you migrating your collections. Otherwise, you can also ask for help on Astro Support Squid. |
📚 Subject area/topic
Content Loader API
📋 Page(s) affected (or suggested, for new content)
https://docs.astro.build/en/reference/content-loader-reference/#file-loader
📋 Description of content that is out-of-date or incorrect
Currently the
file()
loader API reference contains this line:What this line leaves out is that if you do use an object with string keys, the values must also be objects
This caused some confusion when a user attempted to do something like this:
Which resulted in a schema error expecting an object but receiving a string
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
A reproduction was created here by the discord member that brought it to my attention
https://github.com/anmpog/content-collection-issue-repro
The text was updated successfully, but these errors were encountered: