-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image component doesn't recognize local images in the new Content Layer API #12025
Comments
Thanks for posting this issue. I wasted hours on this yesterday thinking I did something wrong. |
I can confirm this. The schema const myCollection = defineCollection({
loader: glob({
pattern: "**/*.mdx",
base: "./src/data/collection",
}),
schema: ({ image }) =>
z.object({
title: z.string(),
image: image(), // <-- this
}),
}); Astro v4.15.7
Node v20.11.1
System Linux (x64)
Package Manager pnpm
Output hybrid
Adapter @astrojs/node
Integrations @astrojs/mdx
@astrojs/sitemap |
This seems to be caused by the path being absolute, modifying the reproduction to use a relative path makes it work |
For me, it's dynamically importing images that doesn't work at all now after upgrading (using this recipe). Never had an issue before. |
That seems unrelated, this issue is specifically about the |
Yes, I use absolute paths for linked images eg |
Fixed by #12030 |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
After migrating to the new Content Layer API, the Image component is no longer able to recognize local images when the source is provided by a content collection. This is causing issues as the component now requires manual setting of image dimensions, which should not be necessary by default.
https://docs.astro.build/en/guides/images/#images-in-content-collections
What's the expected result?
Image component shouldn't ask for dimensions of local images
Link to Minimal Reproducible Example
https://codesandbox.io/p/devbox/z22xn5
Participation
The text was updated successfully, but these errors were encountered: