From 93672651b683a4f30fc653bb9c562736b4e68779 Mon Sep 17 00:00:00 2001 From: Charles Villard Date: Thu, 3 Oct 2024 23:31:56 -0400 Subject: [PATCH 1/2] Reference dynamic route variables in Legacy Collection examples in v5.mdx As dynamic routes are also allowed to use variables, it's easy to overlook when following directions specific to file content. This PR explicitly calls out changing any references to `slug` used in dynamic routes to `id`. --- src/content/docs/en/guides/upgrade-to/v5.mdx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/content/docs/en/guides/upgrade-to/v5.mdx b/src/content/docs/en/guides/upgrade-to/v5.mdx index c6a42e4c1f681..f9081e0430bfd 100644 --- a/src/content/docs/en/guides/upgrade-to/v5.mdx +++ b/src/content/docs/en/guides/upgrade-to/v5.mdx @@ -257,6 +257,15 @@ See the instructions below for updating an existing content collection with Mark --- ``` + ** Be sure to also do the same for files as well. + + ```astro ins={4} del={3} + // src/pages/blog + --- + [...slug].astro + [...id].astro + ``` + 4. **Switch to the new `render()` function**. Entries no longer have a `render()` method, as they are now serializable plain objects. Instead, import the `render()` function from `astro:content`. ```astro title="src/pages/index.astro" ins=", render" del={6} ins={7} From 6aecb12616878f24886ab522155125213cf46261 Mon Sep 17 00:00:00 2001 From: Charles Villard Date: Mon, 7 Oct 2024 00:34:39 +0000 Subject: [PATCH 2/2] Remove file name diff, update copy, and rename filename on diff --- src/content/docs/en/guides/upgrade-to/v5.mdx | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/content/docs/en/guides/upgrade-to/v5.mdx b/src/content/docs/en/guides/upgrade-to/v5.mdx index f9081e0430bfd..b6da371fb6543 100644 --- a/src/content/docs/en/guides/upgrade-to/v5.mdx +++ b/src/content/docs/en/guides/upgrade-to/v5.mdx @@ -241,10 +241,10 @@ See the instructions below for updating an existing content collection with Mark }); ``` -3. **Change references from `slug` to `id`**. Content layer collections do not have a `slug` field. Instead, all updated collections will have an `id`. +3. **Change references from `slug` to `id`**. Content layer collections do not have a `slug` field. Instead, all updated collections will have an `id`. You may also need to update your file name to match an updated getStaticPaths() parameter: ```astro ins={7} del={6} - // src/pages/[slug].astro + // src/pages/[id].astro --- export async function getStaticPaths() { const posts = await getCollection('blog'); @@ -257,15 +257,6 @@ See the instructions below for updating an existing content collection with Mark --- ``` - ** Be sure to also do the same for files as well. - - ```astro ins={4} del={3} - // src/pages/blog - --- - [...slug].astro - [...id].astro - ``` - 4. **Switch to the new `render()` function**. Entries no longer have a `render()` method, as they are now serializable plain objects. Instead, import the `render()` function from `astro:content`. ```astro title="src/pages/index.astro" ins=", render" del={6} ins={7}