davestewart / nuxt-content-assets

Enable locally-located assets in Nuxt Content
https://npmjs.com/package/nuxt-content-assets
114 stars 8 forks source link

Relative paths not working #47

Closed jvolker closed 1 year ago

jvolker commented 1 year ago

Background

I'm trying to get relative paths working as described in the Readme.

I'm using:

In /content/work/myProject/index.md I put

![thumbnail](thumbnail.jpg)

Issue

This resolves to <img src="thumbnail.jpg" alt="thumbnail"> so the image source points to http://localhost:3000/work/myProject/thumbnail.jpg, which is not returning the image but something that looks similar to the project page.

This happens with npm run-script devas well as npm run-script generate using ProseImg and Nuxt-Image.

Any help is highly appreciated. Thanks in advance!

davestewart commented 1 year ago

OK, just jumping back into this.

This is running as described in the How it works section; Nitro should serve the image in dev, and in build it should be copied to the output folder where it loads as an asset.

What happens if you open http://localhost:3000/work/myProject/thumbnail.jpg in a new tab?

Do you see the image?


Regards "how it works" here's the built demo folder to illustrate:

image

This is the image in the demo:

image

Here are links to the source:

jvolker commented 1 year ago

Thanks for your reply. In the meantime, the demo is working again, and this also working for me as described.

I have also updated nuxt-content-assets to 1.3.3. So I'm not sure if this was fixing it or something else.