relative( url )

Returns a relative link to the specified URL, based on the current effective directory, folder.

The best way to explain this is probably by example, so here we go: First of all, lets create a new URL object for a file inside a directory, e.g.

:-) folder.addLast( "parent" );
:-) var url = newURL( "myfile", "html" );
There are 0 results
      

Lets have a look at the URL object to see what it contains:

:-) url;
There is 1 result
/parent/myfile.html
      

the URL we've created represents a HTML file that is contained within a folder in out output directory. Now without changing the current effective working directory, lets see what a relative link to the URL looks like:

:-) url.relative;
There is 1 result
"myfile.html"
      

it simply links to the file, which is what I hope you'd expect. Now let's change the working directory, by removing the folder we created the file in:

:-) folder.removeLast();
      

and now let's see what happened to the relative link:

:-) url.relative;
There is 1 result
"parent/myfile.html"
      

so the relative link from the current effective working directory to the URL now contains the folder the URL was created in. Again I hope this is all just as you'd expect. Now to complete the example we'll add a couple of folders to the working directory and see how the relative link changes:

:-) folder.addLast( "test" );
:-) url.relative;
There is 1 result
"../parent/myfile.html"
:-) folder.addLast( "test-child" );
:-) url.relative;
There is 1 result
"../../parent/myfile.html"