#Pages not building after using image in markdown file

6 messages · Page 1 of 1 (latest)

sinful venture
#

@robust bear Hey, I have a blog using Astro. Just recently updated to the latest version.

I use markdown files for my blog posts. When I add a image like this "A starry night sky." the whole project breaks. Only the pages called "index.html" will generate. If I remove the linke from the markdown file everything generates like normal.

I use Typescript on relax and Postcss with preset-env and cssnano. My full project is here: https://github.com/BryanHogan/bryanhogancom

What causes does? How do I fix it?

GitHub

Contribute to BryanHogan/bryanhogancom development by creating an account on GitHub.

robust bearBOT
#

Hi @sinful venture. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, it seems like you're encountering an issue with Astro's image handling in Markdown files. Astro automatically optimizes images referenced in your Markdown content. However, if Astro cannot find an image you included in your Markdown content, it can cause issues. This is usually caused by a typo in the path or incorrect relative path.

In your case, you're using the relative path ../../assets/test.png to reference your image. Images in Markdown are relative to the current file. To refer to an image that is located in the same folder as the .md file, the path should start with ./.

If the image is not in the same directory as your Markdown file, you may need to adjust the relative path accordingly. Make sure that the path correctly points to the location of your image file in your project structure.

If you're certain that the path is correct, you might be encountering a known bug. There are several open issues related to image handling in Astro, such as this one (https://github.com/withastro/astro/issues/7761) and this one (https://github.com/withastro/astro/issues/7223). You might want to check these issues to see if they match your problem.

If none of the above solutions work, I would recommend creating a new issue in the Astro GitHub repository (https://github.com/withastro/astro/issues) detailing your problem. The Astro team and community can then help you find a solution.

For more information on using images in Astro, you can check out the Images Guide (https://docs.astro.build/en/guides/images/) in the Astro documentation.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@sinful venture kapa.ai is still learning and improving, please let us know how it did by reacting below

cerulean wraith
#

This is a known issue at the moment, currently working on a fix

sinful venture