Skip to content

Conversation

sarah11918
Copy link
Member

@sarah11918 sarah11918 commented Sep 22, 2025

This adds "Removed: content collections" to the v6 upgrade guide

Direct deploy preview: https://deploy-preview-12376--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#removed-legacy-content-collections

Implementation PR #14407

This PR should include

  • Upgrade guide content for removal
  • Remove legacy flag docs
  • placeholder error messages so that links will work (both to them, and allow us to check links in them, if necessary)
    • the content here doesn't have to be 100% accurate -- it will be overwritten with the JSDoc eventually
    • I did not (yet?) bother to add these to the error index page as that will also be autogenerated and isn't needed for resolving or checking links

Notes:

  • there should not be any new astro:content reference updated needed: v5 already only documents the newest API
  • any guide/reference changes will be handled along with Live Collections becoming stabilized (which will probably affect how we describe collections in general, and will bring larger docs needs around collections and API reference)

Copy link

netlify bot commented Sep 22, 2025

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 171c416
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/68d57f8e1e22990008e4aace
😎 Deploy Preview https://deploy-preview-12376--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented Sep 22, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/upgrade-to/v6.mdx Source changed, localizations will be marked as outdated.
en/reference/errors/content-collection-invalid-type.mdx Localization added, will be marked as complete.
en/reference/errors/content-collection-missing-loader.mdx Localization added, will be marked as complete.
en/reference/errors/legacy-content-config-error.mdx Localization added, will be marked as complete.
en/reference/legacy-flags.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@sarah11918 sarah11918 added the 6.0 label Sep 22, 2025
@sarah11918 sarah11918 added this to the v6.0.0 docs milestone Sep 22, 2025
@sarah11918 sarah11918 changed the title Content collections removed support for legacy content collections removed Sep 24, 2025

<SourcePR number="14407" title="fix: remove legacy content collections"/>

In Astro 5.x, it was still possible to use [the Content Collections API first introduced in Astro v2.0](https://astro.build/blog/introducing-content-collections/), either through a `legacy` configuration flag or via built-in backwards compatibility. These methods allowed you to upgrade to Astro v5 even if you were not yet ready or able to update your content collections to the new Content Layer API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're uisng the "content layer" terminology externally, are we?

Copy link
Member Author

@sarah11918 sarah11918 Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have it scattered around the content collections page, but we can choose to remove that now that a) there's absolutely no need to distinguish between legacy anymore and b) we will have live collections, so probably need some repositioning anyway.

It might still be helpful here and there in the upgrade guide, when the phrase was in use for v5? But I think we can for sure now remove it from our regular documentation for v6.


In Astro 5.x, it was still possible to use [the Content Collections API first introduced in Astro v2.0](https://astro.build/blog/introducing-content-collections/), either through a `legacy` configuration flag or via built-in backwards compatibility. These methods allowed you to upgrade to Astro v5 even if you were not yet ready or able to update your content collections to the new Content Layer API.

**Astro v6.0 removes this previously deprecated Content Collections API support entirely, including the `legacy.collections` flag.** All content collections must now use the Content Layer API introduced in Astro v5.0 that powers all content collections. No backwards compatibility support is available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Astro v6.0 removes this previously deprecated Content Collections API support entirely, including the `legacy.collections` flag.** All content collections must now use the Content Layer API introduced in Astro v5.0 that powers all content collections. No backwards compatibility support is available.
**Astro v6.0 removes this previously deprecated legacy content collections API support entirely, including the `legacy.collections` flag.** All content collections must now use the new API introduced in Astro v5.0 that powers all content collections. No backwards compatibility support is available.


If you have content collections errors after upgrading to v6, use the following list to help you identify and upgrade any legacy features that may exist in your code.

##### If you have...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the error messages in here too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this could be helpful, or at least the error code so someone can easily identify the details to expand.

Copy link
Member Author

@sarah11918 sarah11918 Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Would the implementation PR be a comprehensive list of all the ones they might encounter?

I'm seeing:

  • 'LegacyContentConfigError'
  • 'ContentCollectionMissingLoader'
  • 'ContentCollectionInvalidType'

What we did for v5 was mock up the new errors / config in the v5 branch (duplicating what would be generated from the JSDoc), so we should probabably manually recreate those errors in this PR, too. If they end up not being identical, then a ci PR will be generated to align them.

Just copied the entire jsdoc from entries here for now
  • @docs
  • @message
  • Example error message:
  • Found legacy content config file in "src/content/config.ts". Please move this file to "src/content.config.ts" and ensure each collection has a loader defined.
  • @description
  • A legacy content config file was found. Move the file to src/content.config.ts and update any collection definitions if needed.
  • See the Astro 6 migration guide for more information.
    */

export const LegacyContentConfigError = {
name: 'LegacyContentConfigError',
title: 'Legacy content config file found.',
message: (filename: string) =>
Found legacy content config file in "${filename}". Please move this file to "src/content.config.${filename.split('.').at(-1)}" and ensure each collection has a loader defined.,
hint: 'See https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on updating collections.',
} satisfies ErrorData;

/**

  • @docs
  • @message
  • Example error message:
  • Collections must have a loader defined. Check your collection definitions in your content config file.
  • @description
  • A content collection is missing a loader definition. Make sure that each collection in your content config file has a loader.
  • See the Content collections documentation for more information.
    */

export const ContentCollectionMissingLoader = {
name: 'ContentCollectionMissingLoader',
title: 'Content collection is missing a loader definition.',
message: (file = 'your content config file') =>
Collections must have a \loader` defined. Check your collection definitions in ${file}.`,
hint: 'See https://docs.astro.build/en/guides/content-collections/ for more information on content loaders and https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on migrating from legacy collections.',
} satisfies ErrorData;

/**

  • @docs
  • @message
  • Example error message:
  • Invalid collection type "data". Remove the type from your collection definition in your content config file.
  • @description
  • Content collections should no longer have a type field. Remove this field from your content config file.
  • See the Astro 6 migration guide for more information.
    */

export const ContentCollectionInvalidType = {
name: 'ContentCollectionInvalidType',
title: 'Content collection has an invalid type field.',
message: (type: string, file = 'your content config file') =>
Invalid collection type "${type}". Remove the type from your collection definition in ${file}.,
hint: 'See https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on migrating from legacy collections.',
} satisfies ErrorData;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also some places where we just log a warning rather than throwing an error:

https://github.com/withastro/astro/pull/14407/files#diff-04e44d3cde1db4d52d43a7732043f5239e1c49479b993e3dda7486399a5a51fbR214-R223

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add a more searchable name there too.

Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small nit, otherwise I think this format looks great and makes sense!


In Astro 5.x, it was still possible to use [the Content Collections API first introduced in Astro v2.0](https://astro.build/blog/introducing-content-collections/), either through a `legacy` configuration flag or via built-in backwards compatibility. These methods allowed you to upgrade to Astro v5 even if you were not yet ready or able to update your content collections to the new Content Layer API.

**Astro v6.0 removes this previously deprecated Content Collections API support entirely, including the `legacy.collections` flag.** All content collections must now use the Content Layer API introduced in Astro v5.0 that powers all content collections. No backwards compatibility support is available.
Copy link
Member Author

@sarah11918 sarah11918 Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Astro v6.0 removes this previously deprecated Content Collections API support entirely, including the `legacy.collections` flag.** All content collections must now use the Content Layer API introduced in Astro v5.0 that powers all content collections. No backwards compatibility support is available.
**Astro v6.0 removes this previously deprecated Content Collections API support entirely, including the `legacy.collections` flag.** All content collections must now use [the Content Layer API introduced in Astro v5.0](https://astro.build/blog/content-layer-deep-dive/) that powers all content collections. No backwards compatibility support is available.

For example, we could do this here, then use all the rest of your suggestions for just legacy/new. This link is probably more important than the 2.0 one, and we could even remove the other link in favour of just this one.


Astro v5.x included some automatic backwards compatibility to allow content collections to continue to work even if they had not been updated to use the new API. Therefore, your v5 collections may contain one or more legacy features that need updating to the newer API for v6, even if your project was previously error-free.

If you have content collections errors after upgrading to v6, use the following list to help you identify and upgrade any legacy features that may exist in your code.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you have content collections errors after upgrading to v6, use the following list to help you identify and upgrade any legacy features that may exist in your code.
If you have [content collections errors](/en/reference/error-reference/#content-collection-errors) after upgrading to v6, use the following list to help you identify and upgrade any legacy features that may exist in your code.

The link exists, but I haven't bothered to put these individual errors on the index page. I don't know whether we need to explicitly include the 3 legacy errors here, or just point them to the content collections general set of errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants