Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/content/docs/en/guides/upgrade-to/v5.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ See the instructions below for updating an existing content collection (`type: '

1. **Move the content config file**. This file no longer lives within the `src/content/` folder. This file should now exist at `src/content.config.ts`.

2. **Edit the collection definition**. Your updated collection requires a `loader` which indicates both a folder for the location of your collection (`base`) and a `pattern` defining the collection entry filenames and extensions to match. (You may need to update the example below accordingly. You can use [globster.xyz](https://globster.xyz/) to check your glob pattern.) The option to select a collection `type` is no longer available.
2. **Edit the collection definition**. Your updated collection requires a `loader` which indicates both a folder for the location of your collection (`base`) and a `pattern` defining the collection entry filenames and extensions to match. (You may need to update the example below accordingly. You can use [globster.xyz](https://globster.xyz/) to check your glob pattern.) The option to select a collection `type` is no longer available. Different from content collctions, the `glob()` loader normalizes `id`s to a kebab-cased slug by default, so hard-coded `id`s that contain capital letters (like `getEntry("UpperCase")`) in your code may break. You can pass a custom [`generateID()` helper function](/en/reference/content-loader-reference/#generateid) to override this behavior.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This step is becoming very long and hard to parse. And, the code snippet below doesn't display generateId().
I wonder if it wouldn't be more readable to use the wording suggested for the v6 upgrade guide and place it below the code snippet.


```ts ins={3,8} del={7}
// src/content.config.ts
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/en/guides/upgrade-to/v6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ const blog = defineCollection({
}),
});
```

Different from content collections, the `glob()` loader normalizes `id`s to kebab-cased slugs by default, so hard-coded `id`s including capital letters (like `getEntry("UpperCase")`) in your code may break. You can pass a custom [`generateID()` helper function](/en/reference/content-loader-reference/#generateid) to override this behavior.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about something like:

Suggested change
Different from content collections, the `glob()` loader normalizes `id`s to kebab-cased slugs by default, so hard-coded `id`s including capital letters (like `getEntry("UpperCase")`) in your code may break. You can pass a custom [`generateID()` helper function](/en/reference/content-loader-reference/#generateid) to override this behavior.
By default, the `glob()` loader generates an ID by converting all uppercase letters to lowercase. Therefore, you may need to check and update your calls to `getEntry()` or [use the `generateId()` helper to restore the old behavior](/en/guides/content-collections/#defining-custom-ids).
  • Unless I'm mistaken, what has changed is not really the slugs in kebab-case but the identifier in lowercase, so we should probably be more direct in drawing attention to this new behavior.
  • We have an example in the content collections guide to restore the old behavior. So, it might be more helpful to use that link rather than the reference.

</details>

<details>
Expand Down
Loading