How to reference image paths when using collectionsv

I almost have the same issue with this question: https://github.community/t5/GitHub-Pages/Image-Path-when-the-file-isn-t-in-the-root/m-p/14340

adding “…” before the path for images seem to work, but since I’m using the function of Collections in my github pages, I use a permalink in my config.yml file:

collections:

   servicenow:

     output: true

     permalink: servicenow/:path/

So what happens is that, when the .md file loads in the site coming from my servicenow collection, it appends the website url and breaks the link. It will be something like this:

https://pages.git.cwp.pnp-hcl.com/maurice-nipal/hcl-support/servicenow/docs/assets/caseview1.JPG

(this will show a page 404)

Whereas the correct path to the image is like this:

https://pages.git.cwp.pnp-hcl.com/maurice-nipal/hcl-support/docs/assets/newcase1.jpg

(notice that it is in the hcl-support/docs/assets/ folder)

the added servicenow from the permalink breaks the URL. do you have other best practice to reference an image path? I’m concerned that if I fork this to another github profile (not maurice-nipal) all the links will be broken because it is explicitly found in the URL.

Appreciate any help!

You can use .. to go up one level and repeat .. separated by / to go up multiple levels. For example, you could use ../../.. to go up three directories. If ./foo/bar/baz.jpg is causing the problem you’re describing, then ../foo/bar/baz.jpg should fix it.

I hope that helps!