Skip to content

Conversation

@ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Sep 19, 2025

Changes

Closes #14361.

This PR removes a number of APIs and options related to legacy content collections that were deprecated in Astro 5, including:

  • The legacy.collections option, which was added in Astro 5 and caused the old content collections system to be used instead of the new one.
  • Deprecated functions from astro:content: getEntryBySlug and getDataEntryById are both replaced by getEntry(), which is a drop-in replacement for both.
  • Support for the old src/content/config.* file location. You must now use src/content.config.*.
  • Automatically generating collections when a src/content/ directory is present and no content config file exists. You must now explicitly define collections in src/content.config.*.
  • Support for collections without a loader. You must now use the glob() loader to create collections from filesystem content. This will also mean that generated entries use the new entry format:
    • The id field is now a slug, not a filename. You can access the filename via entry.filePath, which is the path relative to the site root.
    • There is no longer a slug field – use id instead.
    • You can no longer call entry.render() on content entries. Use render(entry) instead, imported from astro: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.

@changeset-bot
Copy link

changeset-bot bot commented Sep 19, 2025

🦋 Changeset detected

Latest 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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) docs pr semver: major Change triggers a `major` release labels Sep 19, 2025
Copy link
Contributor

@github-actions github-actions bot left a 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.

@ascorbic ascorbic changed the title Remove-legacy-cc wip: remove legacy content collections Sep 19, 2025
@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Sep 19, 2025
@github-actions github-actions bot added the pkg: example Related to an example package (scope) label Sep 19, 2025
@ascorbic ascorbic self-assigned this Sep 22, 2025
@ascorbic ascorbic changed the title wip: remove legacy content collections fix: remove legacy content collections Sep 23, 2025
@ascorbic ascorbic marked this pull request as ready for review September 23, 2025 12:40
Copy link
Member

@florian-lefebvre florian-lefebvre left a 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

);
}
config.type = CONTENT_LAYER_TYPE;
// TODO: add links to the migration guide in these errors
Copy link
Member

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

@ascorbic ascorbic merged commit 3bda3ce into next Sep 23, 2025
13 of 20 checks passed
@ascorbic ascorbic deleted the remove-legacy-cc branch September 23, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope) semver: major Change triggers a `major` release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants