-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Migrate to Content Layer API #1611
Labels
Comments
albertchae
added a commit
that referenced
this issue
Mar 10, 2025
thilobillerbeck
pushed a commit
that referenced
this issue
Mar 18, 2025
Fixes: #1611 Following https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections, changes of the same type are grouped into commits - turn off legacy.collections and define `src/content.config.ts`. Previously we were getting the content config autogenerated by directory. This is technically still available as a deprecated feature, but it wouldn't work for us anyway because it only globs on md/mdx files ``` Auto-generating collections for folders in "src/content/" that are not defined as collections. This is deprecated, so you should define these collections yourself in "src/content.config.ts". The following collections have been auto-generated: blog, community, download, explore, landing, landing-features, learning-manuals, menus, research, sponsors, teams ``` ``` 08:35:29 [WARN] [glob-loader] No files found matching "**/*{.md,.mdx},!**/_*/**/*{.md,.mdx},!**/_*{.md,.mdx}" in directory "src/content/community" 08:35:29 [WARN] [glob-loader] No files found matching "**/*{.md,.mdx},!**/_*/**/*{.md,.mdx},!**/_*{.md,.mdx}" in directory "src/content/explore" 08:35:29 [WARN] [glob-loader] No files found matching "**/*{.md,.mdx},!**/_*/**/*{.md,.mdx},!**/_*{.md,.mdx}" in directory "src/content/landing" 08:35:29 [WARN] [glob-loader] No files found matching "**/*{.md,.mdx},!**/_*/**/*{.md,.mdx},!**/_*{.md,.mdx}" in directory "src/content/menus" 08:35:29 [WARN] [glob-loader] No files found matching "**/*{.md,.mdx},!**/_*/**/*{.md,.mdx},!**/_*{.md,.mdx}" in directory "src/content/sponsors" 08:35:29 [WARN] [glob-loader] No files found matching "**/*{.md,.mdx},!**/_*/**/*{.md,.mdx},!**/_*{.md,.mdx}" in directory "src/content/research" ``` - replace slug with id. Did not do the same for `src/pages/community/teams/[...slug].astro` because it wasn't strictly necessary and the example in the migration guide has an example with `[slug]` in the filename getting populated from a collection entry in `getStaticPaths` - Switch to the new render() function. > Entries no longer have a render() method, as they are now serializable plain objects. Instead, import the render() function from astro:content. - Manually sort collections when necessary. Previously we were relying on collection entries being sorted lexicographically from the directory, but this behavior has now changed. Except for blog entries which are already being sorted by date, we explicitly sort lexicographically (using [`localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) because [array sort wants a comparator function that returns negative, 0 or positive to indicate order](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) > Sort order of generated collections is non-deterministic and platform-dependent. This means that if you are calling getCollection(), the order in which entries are returned may be different than before. If you need a specific order, you must sort the collection entries yourself. --------- Co-authored-by: Albert Chae <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Due to the upgrade to Astro v5 the Content Collections v2 API is now deprecated, to keep the site and all upgrades moving I temporarily enabled the legacy collection support. I postponed the migration because it requires some more work. This issue is used to track it.
Migration guide: https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections
The text was updated successfully, but these errors were encountered: