xy2z / PineDocs

A fast and lightweight site for viewing files
GNU General Public License v3.0
141 stars 19 forks source link

Question - Relative paths for images #94

Closed sohnemann closed 4 years ago

sohnemann commented 4 years ago

Hey there,

how would one go about adding images to a document that are available in the filesystem? I tried everything, but I just can't get it to work.

What I tried so far: /index.md /giphy.gif

Inside index.md:

![welcome2](giphy.gif)
![welcome2](/giphy.gif)
![welcome2](./giphy.gif)

But whatever I do, I always receive a 404.

When I checked the developer tools in Firefox, I saw how the markdown files are retrieved:

/?&action=get_file_data&relative_path=index.md

When I replaced index.md with giphy.gif, It did load the image file.

xy2z commented 4 years ago

Are you using Docker? If not, you could just add the images in the "public" folder, and your markdown example should work.

If you are using Docker, you could make a volume to the "public/img" dir and the change the image path in your markdown to eg. /img/giphy.gif

sohnemann commented 4 years ago

Thanks, adding the volume for the public folder fixed it! :) The whole configuration with Docker-Compose & Traefik got me a bit confused.

xy2z commented 4 years ago

Glad it's working 😄