-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: remove legacy content collections #14407
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
Conversation
🦋 Changeset detectedLatest commit: beeeff1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a major changeset. A reviewer will merge this at the next release if approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For each API that has a deprecation helper instead of just not existing anymore (eg getEntryById), can you add a todo comment so we don't forget to remove them later on? Maybe a comment for v7
packages/astro/src/content/config.ts
Outdated
| ); | ||
| } | ||
| config.type = CONTENT_LAYER_TYPE; | ||
| // TODO: add links to the migration guide in these errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI there's still this todo here
Changes
Closes #14361.
This PR removes a number of APIs and options related to legacy content collections that were deprecated in Astro 5, including:
legacy.collectionsoption, which was added in Astro 5 and caused the old content collections system to be used instead of the new one.astro:content:getEntryBySlugandgetDataEntryByIdare both replaced bygetEntry(), which is a drop-in replacement for both.src/content/config.*file location. You must now usesrc/content.config.*.src/content/directory is present and no content config file exists. You must now explicitly define collections insrc/content.config.*.glob()loader to create collections from filesystem content. This will also mean that generated entries use the new entry format:idfield is now a slug, not a filename. You can access the filename viaentry.filePath, which is the path relative to the site root.slugfield – useidinstead.entry.render()on content entries. Userender(entry)instead, imported fromastro:content.Testing
Literally hundreds of updated tests! We never updated lots of the fixtures in Astro 5, instead relying on the legacy support. This PR takes the plunge and does the update.
A lot of tests are failing in
next, so it's not always 100% clear if there are more that need updating. I think I've found them all though.Docs
The docs already reflect the current behaviour. The upgrade guide is in progress.