dillionverma / portfolio

Minimalist developer portfolio using Next.js 14, React, TailwindCSS, Shadcn UI and Magic UI
https://portfolio-magicui.vercel.app
MIT License
694 stars 136 forks source link

How to use Images inside the Blog of MDX format #12

Closed Shailendra1703 closed 2 months ago

Shailendra1703 commented 3 months ago

I tried using the mdx format but it didn't worked for me

![alttext](image path)

can any one suggest how can I use images inside a blog post ?

pyerino commented 2 months ago

It works for me. Can you send the code you're using, please?

Shailendra1703 commented 2 months ago

It works for me. Can you send the code you're using, please?


title: "My Blog" publishedAt: "2024-07-18" summary: "My first post on my new blog."

I'm simply importing my image from the public folder with the below syntax.

![myimage](/public/images/myblog.jp)

console.log("Hello World");

Edit: Alright on removing the public from the image path it worked , Thanks

pyerino commented 2 months ago

I think your problem is with directory.

Try removing /public:

Old

![myimage](/public/images/myblog.jp)

New one

![myimage](/images/myblog.jp)