The best practice is to always denote root folder (/) in your paths. If you use a path without / e.g. Assets/images/img2.jpg, the browser will be able to find that image if you're at somedomain.com/index.html, but if you're at somedomain.com/somefolder/index.html, the browser will look for Assets folder, inside the current folder instead of starting from the root.
I hope that helps!
1 person found this helpful
Which means, in a sub page in this case "somedomain.com/somefolder/index.html" you'll have to point to "../Assets" right?
Hi Mario, I thought I sounded like a beginner in my last question but I'm not.
The reason I asked this question because I can confirm that my theory is true.
So here it goes:
I have index.html in the root folder as well as a stylesheet folder which has the modulestylesheet.css and global.css
in the global.css I have 2 classes, each with a different background image, and the first one's url is pointing to (../Assets/images/image1.jpg) and the second class is pointing to (/Assets/images/image2.jpg)
The weird thing is (which made me start this discussion in the first place) is that both of them work, even after clearing the cache, reloading and resetting the browser. Where in a typical hosting account, it will definitely break. Even in Dreamweaver it's breaking.
I'm a guy who is a bit funny to know why and how everything works (which I think is part of someone cursed with quality control).
This is why I needed some clarification on how this can be still possible, what is BC's logic behind this. I just don't like surprises in the future.
Does not work in all cases though so do not break the convention of how BC has been implemented.
With a CMS true functioanlity targeting of files often will require you to place a system code tag or say php code tag with the CMS to insert the root/template location of the site.
BC implemented the great easy system of / as the means to read from the root.
It is pretty simple, it works very well, covers every aspect from web apps, sub folders, css... so it is good to keep to this and cosistancy as even if BC make infustructure changes this will continue to work, other path formats may change if they modify further the internal system file handing structure which for example when Liquid becomes availible has layotus under _system for example. Does not effect this of course but just an example of how BC can change system structures at any time.
Liam, I appreciate when you help everyone everyday from your own personal time, but a question: Why do you love to play mysterious sometimes
Anyway, what is that "Does not work in all cases?"
Are you suggesting that no matter where is the file located, we can always point to elements using "/Folder..." ?
To your latter part, yes, because it's BC's impelemntation for root access rather then making you use a tag all the time, it is very elleggant and wont be effect by any file management or structure changes unless massivly drastic.
HAHAHAHA, you're so funny.