From f1e5704e6547ca4dae03ccfec932a62345d82f60 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Fri, 26 Sep 2025 11:00:05 +0200 Subject: [PATCH 1/7] feat: deprecate Astro in getStaticPaths --- src/content/docs/en/guides/upgrade-to/v6.mdx | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index 983472171468f..a5cc53037fc89 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -97,6 +97,30 @@ The following deprecated features are no longer supported and are no longer docu Some deprecated features may temporarily continue to function until they are completely removed. Others may silently have no effect, or throw an error prompting you to update your code. +### `Astro` in `getStaticPaths()` + +Until now, it was possible to access the `Astro` object in `getStaticPaths()`. However, despite being typed the same as the `Astro` object accessible in the frontmatter, this object only had `site` and `generator` properties. + +In Astro 6.0, accessing `Astro.site` or `Astro.generator` within `getStaticPaths()` will log a warning. Accessing any other property will throw an error. In a future major version, accessing `Astro.site` or `Astro.generator` will also throw an error. + +#### What should I do? + +Remove usage of `Astro.generator` and update all occurrences of `Astro.site` in `getStaticPaths()`: + +```astro title="src/pages/blog/[slug].astro" del={5,6} ins={7} +--- +import { getPages } from "../../../utils/data"; + +export async function getStaticPaths() { + console.log(Astro.generator); + return getPages(Astro.site); + return getPages(import.meta.env.SITE); +} +--- +``` + +Read more about [`import.meta.env.SITE`](https://docs.astro.build/en/guides/environment-variables/#default-environment-variables). + ## Removed The following features have now been entirely removed from the code base and can no longer be used. Some of these features may have continued to work in your project even after deprecation. Others may have silently had no effect. From 365b8b57fc80c4de3dcda8b6f60799a2a57b1bdb Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Fri, 26 Sep 2025 13:50:54 +0200 Subject: [PATCH 2/7] Update src/content/docs/en/guides/upgrade-to/v6.mdx Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> --- src/content/docs/en/guides/upgrade-to/v6.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index a5cc53037fc89..ed78390299649 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -119,7 +119,7 @@ export async function getStaticPaths() { --- ``` -Read more about [`import.meta.env.SITE`](https://docs.astro.build/en/guides/environment-variables/#default-environment-variables). +Read more about [built-in environment variables such as `import.meta.env.SITE`](/en/guides/environment-variables/#default-environment-variables) that are accessible when [using `getStaticPaths()` to dynamically generate static routes](/en/guides/routing/#static-ssg-mode). ## Removed From 730a47e9e65a692174b1c94e57acc6af41dfc3c2 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Fri, 26 Sep 2025 13:51:05 +0200 Subject: [PATCH 3/7] Update src/content/docs/en/guides/upgrade-to/v6.mdx Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> --- src/content/docs/en/guides/upgrade-to/v6.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index ed78390299649..2fbba1024349d 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -105,7 +105,7 @@ In Astro 6.0, accessing `Astro.site` or `Astro.generator` within `getStaticPaths #### What should I do? -Remove usage of `Astro.generator` and update all occurrences of `Astro.site` in `getStaticPaths()`: +Update your `getStaticPaths()` function if you were attempting to access any `Astro` properties inside its scope. Remove `Astro.generator` entirely, and replace all occurrences of `Astro.site()` with `import.meta.env.SITE`: ```astro title="src/pages/blog/[slug].astro" del={5,6} ins={7} --- From 16d3a49cd650f48130a4c964057408b3dbbf3004 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Fri, 26 Sep 2025 14:07:49 +0200 Subject: [PATCH 4/7] Update src/content/docs/en/guides/upgrade-to/v6.mdx Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> --- src/content/docs/en/guides/upgrade-to/v6.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index 2fbba1024349d..cc415266675e5 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -99,7 +99,7 @@ Some deprecated features may temporarily continue to function until they are com ### `Astro` in `getStaticPaths()` -Until now, it was possible to access the `Astro` object in `getStaticPaths()`. However, despite being typed the same as the `Astro` object accessible in the frontmatter, this object only had `site` and `generator` properties. +In Astro 5.x, it was possible to access an `Astro` object inside `getStaticPaths()`. However, despite being typed the same as the `Astro` object accessible in the frontmatter, this object only had `site` and `generator` properties. This could lead to confusion about which `Astro` object properties were available inside `getStaticPaths()`. In Astro 6.0, accessing `Astro.site` or `Astro.generator` within `getStaticPaths()` will log a warning. Accessing any other property will throw an error. In a future major version, accessing `Astro.site` or `Astro.generator` will also throw an error. From 4b7066c43dcccfb9648bfa25dcdfd7eaa6fb50fd Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Fri, 26 Sep 2025 14:08:15 +0200 Subject: [PATCH 5/7] Update src/content/docs/en/guides/upgrade-to/v6.mdx Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> --- src/content/docs/en/guides/upgrade-to/v6.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index cc415266675e5..b9e5188eece84 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -101,7 +101,7 @@ Some deprecated features may temporarily continue to function until they are com In Astro 5.x, it was possible to access an `Astro` object inside `getStaticPaths()`. However, despite being typed the same as the `Astro` object accessible in the frontmatter, this object only had `site` and `generator` properties. This could lead to confusion about which `Astro` object properties were available inside `getStaticPaths()`. -In Astro 6.0, accessing `Astro.site` or `Astro.generator` within `getStaticPaths()` will log a warning. Accessing any other property will throw an error. In a future major version, accessing `Astro.site` or `Astro.generator` will also throw an error. +Astro 6.0 deprecates this object for `getStaticPaths()` to avoid confusion and improves error handling when attempting to access `Astro.` values that are unavailable. Using `Astro.site` or `Astro.generator` within `getStaticPaths()` will now log a deprecation warning, and accessing any other property will throw a specific error with a helpful message. In a future major version, this object will be removed entirely, and accessing `Astro.site` or `Astro.generator` will also throw an error. #### What should I do? From eae85ef8100bac3d2e82c927cce7a3f5fd534166 Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:16:08 -0300 Subject: [PATCH 6/7] typo --- src/content/docs/en/guides/upgrade-to/v6.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index b9e5188eece84..7775cceced873 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -101,7 +101,7 @@ Some deprecated features may temporarily continue to function until they are com In Astro 5.x, it was possible to access an `Astro` object inside `getStaticPaths()`. However, despite being typed the same as the `Astro` object accessible in the frontmatter, this object only had `site` and `generator` properties. This could lead to confusion about which `Astro` object properties were available inside `getStaticPaths()`. -Astro 6.0 deprecates this object for `getStaticPaths()` to avoid confusion and improves error handling when attempting to access `Astro.` values that are unavailable. Using `Astro.site` or `Astro.generator` within `getStaticPaths()` will now log a deprecation warning, and accessing any other property will throw a specific error with a helpful message. In a future major version, this object will be removed entirely, and accessing `Astro.site` or `Astro.generator` will also throw an error. +Astro 6.0 deprecates this object for `getStaticPaths()` to avoid confusion and improves error handling when attempting to access `Astro` values that are unavailable. Using `Astro.site` or `Astro.generator` within `getStaticPaths()` will now log a deprecation warning, and accessing any other property will throw a specific error with a helpful message. In a future major version, this object will be removed entirely, and accessing `Astro.site` or `Astro.generator` will also throw an error. #### What should I do? From 394408183bd37b2c7af4a6e781d1636a0ed55083 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Sat, 27 Sep 2025 11:38:14 +0200 Subject: [PATCH 7/7] Update src/content/docs/en/guides/upgrade-to/v6.mdx --- src/content/docs/en/guides/upgrade-to/v6.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index 7775cceced873..9e378e813cf36 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -99,6 +99,8 @@ Some deprecated features may temporarily continue to function until they are com ### `Astro` in `getStaticPaths()` + + In Astro 5.x, it was possible to access an `Astro` object inside `getStaticPaths()`. However, despite being typed the same as the `Astro` object accessible in the frontmatter, this object only had `site` and `generator` properties. This could lead to confusion about which `Astro` object properties were available inside `getStaticPaths()`. Astro 6.0 deprecates this object for `getStaticPaths()` to avoid confusion and improves error handling when attempting to access `Astro` values that are unavailable. Using `Astro.site` or `Astro.generator` within `getStaticPaths()` will now log a deprecation warning, and accessing any other property will throw a specific error with a helpful message. In a future major version, this object will be removed entirely, and accessing `Astro.site` or `Astro.generator` will also throw an error.