withastro / astro · Issue No. 17322
Astro v7.0.6
Node v24.17.0
System macOS (arm64)
Package Manager pnpm
Output static
Adapter none
Integrations none
No response
In Astro v6 and v7, content references are handled inconsistently for entries whose filenames are transformed into different IDs.
Example referenced entry:
src/content/authors/John-Doe.md
Astro's glob loader slugifies the filename and exposes the entry id as:
john-doe
This means getEntry() expects the slugified id:
await getEntry("authors", "john-doe")
However, a reference value using the original filename casing is still accepted during content validation:
{
"author": "John-Doe"
}
With a schema like:
author: reference("authors")
Astro transforms the reference into:
{
"author": {
"id": "John-Doe",
"collection": "authors"
}
}
This reference then does not resolve, because the actual entry id is john-doe, not John-Doe.
As a result, invalid references can pass validation and produce broken or silently missing output at build time.
Astro should handle referenced entry ids consistently with the entry ids produced by content loading.
Either:
For example, this should fail validation if the actual entry id is john-doe:
{
"author": "John-Doe"
}
Or:
For example:
{
"author": "John-Doe"
}
should be transformed into:
{
"author": {
"id": "john-doe",
"collection": "authors"
}
}
This would make reference() consistent with glob() and getEntry() in Astro v6 and v7.
https://github.com/smn-cds/reproduce-broken-references
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.