-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
support for legacy content collections removed #12376
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
3d722b8
removed content collections
sarah11918 07221b6
Merge branch 'v6' into content-collections-removed
sarah11918 ea94f56
links back to v5 content
sarah11918 2471a2b
proper link syntax
sarah11918 9ff6f61
Merge branch 'v6' into content-collections-removed
sarah11918 fddbb86
remove legacy flag documentation
sarah11918 fb4c121
🌭 details? do we like this?
sarah11918 29fb6aa
add the implementation PR and some stronger wording
sarah11918 41f864b
add removing legacy flag
sarah11918 1a71b64
don't focus on collection API names, just legacy/new
sarah11918 e849055
add placeholder error messages
sarah11918 171c416
relative links
sarah11918 5adf67e
links to Content Layer API deep dive blog post and content collection…
sarah11918 be4b2c1
Merge branch 'v6' into content-collections-removed
sarah11918 b342d32
Polishing of upgrade guidance, fix an error message
sarah11918 192934b
Apply suggestions from Armand code review
sarah11918 147afa5
added error messages to summaries of things to check for
sarah11918 9bb8dc3
fix links
sarah11918 935b6d6
fix error link
sarah11918 4649681
missing parenthesis
sarah11918 01342b0
two commas, but one line suggestion so I'm declaring it ONE error fix…
sarah11918 7f20e74
Merge branch 'v6' into content-collections-removed
sarah11918 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/content/docs/en/reference/errors/content-collection-invalid-type.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| # NOTE: This file is auto-generated from 'scripts/error-docgen.mjs' | ||
| # Do not make edits to it directly, they will be overwritten. | ||
| # Instead, change this file: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
| # Translators, please remove this note and the <DontEditWarning/> component. | ||
|
|
||
| title: Content collection invalid type. | ||
| i18nReady: true | ||
| githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
| --- | ||
|
|
||
| import DontEditWarning from '~/components/DontEditWarning.astro' | ||
|
|
||
| <DontEditWarning /> | ||
|
|
||
|
|
||
| > Invalid collection type "data". Remove the type from your collection definition in your content config file. | ||
|
|
||
| ### What went wrong? | ||
|
|
||
| Content collections should no longer have a type field. Remove this field from your content config file. | ||
|
|
||
| See the [Astro 6 migration guide](/en/guides/upgrade-to/v6/#removed-legacy-content-collections) for more information. |
24 changes: 24 additions & 0 deletions
24
src/content/docs/en/reference/errors/content-collection-missing-loader.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| # NOTE: This file is auto-generated from 'scripts/error-docgen.mjs' | ||
| # Do not make edits to it directly, they will be overwritten. | ||
| # Instead, change this file: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
| # Translators, please remove this note and the <DontEditWarning/> component. | ||
|
|
||
| title: Content collection missing loader. | ||
| i18nReady: true | ||
| githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
| --- | ||
|
|
||
| import DontEditWarning from '~/components/DontEditWarning.astro' | ||
|
|
||
| <DontEditWarning /> | ||
|
|
||
|
|
||
| > Collections must have a loader defined. Check your collection definitions in your content config file. | ||
|
|
||
| ### What went wrong? | ||
|
|
||
| A content collection is missing a loader definition. Make sure that each collection in your content config file has a loader. | ||
|
|
||
| **See Also:** | ||
| - [Content collections configuration](/en/guides/content-collections/#defining-the-collection-loader) |
26 changes: 26 additions & 0 deletions
26
src/content/docs/en/reference/errors/legacy-content-config-error.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| # NOTE: This file is auto-generated from 'scripts/error-docgen.mjs' | ||
| # Do not make edits to it directly, they will be overwritten. | ||
| # Instead, change this file: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
| # Translators, please remove this note and the <DontEditWarning/> component. | ||
|
|
||
| title: Legacy content config error. | ||
| i18nReady: true | ||
| githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts | ||
| --- | ||
|
|
||
| import DontEditWarning from '~/components/DontEditWarning.astro' | ||
|
|
||
| <DontEditWarning /> | ||
|
|
||
|
|
||
| > Legacy content config file found. | ||
|
|
||
| ### What went wrong? | ||
|
|
||
| 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](/en/guides/upgrade-to/v6/#removed-legacy-content-collections) for more information. | ||
|
|
||
| **See Also:** | ||
| - [Content collections configuration](/en/guides/content-collections/#the-collection-config-file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should add the error messages in here too
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.
Yes, this could be helpful, or at least the error code so someone can easily identify the
detailsto expand.Uh oh!
There was an error while loading. Please reload this page.
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.
Great idea! Would the implementation PR be a comprehensive list of all the ones they might encounter?
I'm seeing:
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
src/content.config.tsand update any collection definitions if needed.*/
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;
/**
loaderdefined. Check your collection definitions in your content config file.loaderdefinition. Make sure that each collection in your content config file has aloader.*/
export const ContentCollectionMissingLoader = {
name: 'ContentCollectionMissingLoader',
title: 'Content collection is missing a
loaderdefinition.',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;
/**
typefield. Remove this field from your content config file.*/
export const ContentCollectionInvalidType = {
name: 'ContentCollectionInvalidType',
title: 'Content collection has an invalid
typefield.',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;
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.
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
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.
I could add a more searchable name there too.
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.
I can't get to the spot in that link directly from the link, because GitHub can't handle the PR. 😅 Which file are warnings included in so I can get there myself?
Uh oh!
There was an error while loading. Please reload this page.
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.
OK, I've updated the text to refer to both error messages and warnings and we can do further edits on top of that!
I'm not sure they all need to be spelled out here, since in theory those should have their own explanations and guidance. To avoid this content being overwhelming, I think just a mention that "if you get warnings/errors, these are the likely places to check" is fine here! If people are not getting these errors/warnings, no need to be spelling them out.
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.
I just meant adding the specific codes such as
ContentCollectionMissingLoaderto the section, to make each section more searchableThere 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.
Ah, I think I get it. Let me cook!
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.
OK, here's my current draft to address this:
@ascorbic I didn't notice specific errors (either in your removing legacy support PR, nor existing ones) for the situation where:
renderfunction (and are instead calling it on the entry)So, those two don't have associated errors mentioned here. Do we have such errors, and if not, should we?