Sometimes, when your project starts to become rather
complex, you create subdirectories for to structure the
whole thing. As example, I prefer to create a directory
image/
, where all images for buttons and logos
are placed.
Creating a link to an image from the main-directory is no
problem, it's URI simply is image/logo.gif
. But
if your current page is somewhere deeper in your
project-path, eg people/hugo/hugo.html
, you
need to refer to the same image using
../../image/logo.gif
. So you always have to
know the directory-level of your current page.
One solution would be to define a <BASE="path to
main document">
.
But then, all your links have to be absolute. This is very annoying
if you need to refer to files located in the same directory.
But, thanks to hsc, here's the solution to this problem: if you
don't define a <BASE>
-URI, all relative links are
processed as usual. Only if the URI starts with a colon (":"), it
refers to a file relative to the main-path of your project.
For example, an <IMG SRC=":image/back.gif"
ALT="back">
will always refer to the same image,
regardless wheter this tag is called from a file called
welcome.hsc or
people/hugo/hugo.hsc. The difference can only
be recognised in the html-objects: for the first case, an
<IMG SRC="image/back.gif" ALT="back">
will be
created. For the second one, it will be <IMG
SRC="../../image/back.gif" ALT="back">
.