-
-
Notifications
You must be signed in to change notification settings - Fork 244
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 In Post Body Cannot Displayed #56
Comments
+1 Today notice this issue too. With same image path, adding images through tinacms. HeroImage available from _astro folder at the same time |
I am also facing this exact issue. Therefore, I am trying to change the theme entirely. |
I read astro docs about image optimization and TinaCMS docs. Looks like there are no way to fix thus out of box. Every image in mdx must have path under src folder. In this template case, there where images mentioned We can add prebuild step with recursive find all mdx files and using sed regex rule to preprocess all images during build, but I thing it's better doing in JS, not system shell comands for exclude OS, shell differences. |
Based on @serjs I've discovered a workaround which is easy enough if you're okay with it: ---
myfields
---
import { Image } from 'astro:assets'
import image1 from '/src/assets/images/image1.png'
<Image
src={image1}
alt='alttext'
/> After many attempts, this was the easiest way to work around this problem. May it serve you well. |
Fixed this by moving from Sharp image server to Sqoosh. import { defineConfig, squooshImageService } from 'astro/config';
export default defineConfig({
image: {
service: squooshImageService(),
},
}); |
facing same issue |
Use relative paths can solve this problem. |
Hi,
I've found that each post's hero image is displayed correctly because it's defined in the MDX frontmatter section and is built to the /dist/_astro path during the Astro build stage. Unfortunately, however, the image files referenced in the MDX body are not built to that path, which results in the images in the body not being displayed. This might be a silly question to ask, but I'm a complete beginner, could you please help me out? Thank you!
The text was updated successfully, but these errors were encountered: