Closed dwr-studio closed 2 months ago
Hello @dwr-studio! Quick question before we dive deeper: where are the images located in your project? Based on your code, it seems Astro is looking for the image in public/src/images/automated-tools.avif
instead of the src/
directory. If the images are in the src/
directory, we might need to adjust the markdown file to use relative paths correctly or consider moving the images to the public directory. Let me know, and we can investigate further.
@mearashadowfax, thanks for taking the time to respond!
The images are located in src/images
.
I've adjusted the markdown file to use the relative path and now I can see the images after building.
Hello, I’m missing something here.
I want to display an image, let’s say inside the
<MainLayout>
inindex.astro
.This is the code:
When I run
npm run dev
, I can see the image correctly displayed. However, when I runnpm run build
and thennpm run preview
, the image is not displayed and is marked as not found. The final HTML looks like this, with the image’s absolute path preserved:Instead, I should see something like this:
I know you can declare it like this
import tools from "@images/automated-tools.avif";
but what I want to achieve is showing the images coming from a piece of.jsx
code that renders a Swiper slider. These images are fetched from aindex.md
file.I paste here a piece of the Swiper code, running perfectly when
npm run dev
:Then, I created a component
ProductsSlider.astro
:The data is fetched from the corresponding
.md
file:Finally I can retrieve the localized data from the
index.astro
file:The images inside the slider does not show after build as the src is incorrect. Can you point me to the right direction?
Thanks 🙏