shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.72k stars 1.27k forks source link

How to show images? #1115

Closed indarjoko closed 1 year ago

indarjoko commented 1 year ago

I have tried this method but still didn't appeared anything. Can you help me to show how the best method? thanks.

indarjoko commented 1 year ago

https://nextra.site/docs/guide/image#static-image

indarjoko commented 1 year ago

Here's my mdx code

! Hello

dimaMachina commented 1 year ago

can you share your source markdown code?

indarjoko commented 1 year ago

here's my markdown code image

my theme.config.ts code image

indarjoko commented 1 year ago

here's my image assets folder structure

image

dimaMachina commented 1 year ago

You need to put your assets folder inside public folder

indarjoko commented 1 year ago

oke, but I tried to load image from public folder as seen on last pictures. still didn't load images. btw, I deploy from vercel and remote to local PC.

dimaMachina commented 1 year ago

See examples folder in repo with working examples

indarjoko commented 1 year ago

Allright, so I put images folder to .github as seen below and it works.

image

indarjoko commented 1 year ago

here's the result

image

shuding commented 1 year ago

Please read https://nextjs.org/docs/basic-features/static-file-serving. Next.js only serves files inside public as accessible static files.