Skip to content

Conversation

aprici7y
Copy link
Contributor

Fixes #14575

Summary

Restores Astro.site availability in getStaticPaths() by adding back the astroGlobalArgs compiler option that was removed in PR #14405.

Bug

In v5.13.10, Astro.site became undefined when accessed inside getStaticPaths(), even when properly configured in astro.config.mjs.

Root Cause

PR #14405 removed the astroGlobalArgs parameter from the compiler options. This parameter passes the site configuration to the Astro compiler, which injects it into the compiled component, making Astro.site available in the frontmatter code (including getStaticPaths()).

Fix

This PR restores the single line that was removed:

astroGlobalArgs: JSON.stringify(astroConfig.site),

Testing

Verified that Astro.site is now correctly available in getStaticPaths() as a URL object with the configured site value.

Before (v5.13.10)

  • Astro.site in getStaticPaths(): undefined

After (with this fix)

  • Astro.site in getStaticPaths(): URL { href: 'https://example.com/', ... }

Restores the astroGlobalArgs compiler option that was removed in withastro#14405. This parameter is needed to pass the site config to the compiler so Astro.site is available in getStaticPaths().
Copy link

changeset-bot bot commented Oct 19, 2025

🦋 Changeset detected

Latest commit: 1bca9dd

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Oct 19, 2025
Copy link

codspeed-hq bot commented Oct 19, 2025

CodSpeed Performance Report

Merging #14576 will not alter performance

Comparing aprici7y:fix/astro-site-getstaticpaths (1bca9dd) with main (2af62c6)1

Summary

✅ 6 untouched

Footnotes

  1. No successful run was found on main (077b19b) during the generation of this report, so 2af62c6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

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

Thanks!

@florian-lefebvre florian-lefebvre merged commit 2af62c6 into withastro:main Oct 20, 2025
6 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Astro.site no longer available in getStaticPaths()

2 participants