#Can't get the path of the image from the content folder for content collection "blogs"

3 messages · Page 1 of 1 (latest)

hexed summit
#

Hi, I can't figure it out by following the Astro docs. I'm trying to render all blog posts in my blogs.astro component. For that, I'm using Astro Content Collection with subdirectories. I'm using the getCollection() method. Although I can render all the data on my blog page. The image path is not found at any time. I kept them in the src/assets/ folder, content/blog/ folder, and content/blogs/subdirectory folder, but none of them worked. Can anyone help me with this? I'm attaching the screenshot of config.ts, one example MD file, blogs.astro, BlogCard.astro component, folder structure and **rendered webpage **.

violet cipher
#

I have a similar issue: https://discord.com/channels/830184174198718474/1107768262969794580. I figured out a slightly hacky way to combine getCollection() and Astro.glob to get relative image paths, but it does not work in production build. I've spent hours with simply trying to display thumbnails in a list of posts. The only way I can see is to put the images to /public and hardcode the paths. I've tried to import/export the images in the .mdx files themselves, but the exports are not accessible in getCollection(), only the frontmatter is 🙄.

Discord

Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

hexed summit