CityDesk 2.0-Documentation
Forcing Links to be AbsoluteRelative Links
Normally CityDesk creates relative links when you have a hyperlink from one part of your site to another. For example, if you create a hyperlink to an article named target in the same folder, CityDesk will generate the HTML <a href="target.html">. This is a relative link because no matter where you move the site, as long as target.html is in the same folder, the link will work correctly.
This rule also applies to pictures. If an article has a picture named image.jpg in the subdirectory images, CityDesk will generate the HTML <img src="images/image.jpg">.
When you link to an article or file that is in a directory above the current directory, CityDesk uses the .. notation to generate an upwards-relative-link, for example, ../../target.html would link to the file target.html that is two folders above the current folder.
The benefit of relative links is that your entire published site can be picked up and moved somewhere else, and all links will still work correctly. If CityDesk were to generate absolute links like <a href="http://www.example.com/target.html">, then your site could not be moved to a different URL without editing every link. It can even be moved into a subdirectory on another site, and all the links will work unchanged. For example your site might be available at two URLs: http://www.mycompany.com and http://www.myhost.com/~mycompany. The exact same site would work at either publish location because every link is relative.
Sometimes You Don't Want Relative Links...
Sometimes, though, this behavior is not desirable. For example, you may be generating an HTML page that you plan to send in email, and you want all the links to be absolute links, that is, links that include the full URL, so that when the recipient clicks on one of them, their browser launches and goes to your website. Or you may be generating an RSS file, which requires that all hyperlinks be absolute.
You can force CityDesk to make all links in a given file be absolute using the withAbsoluteLinks command:
{$ withAbsoluteLinks "url" $}
For example:
{$ withAbsoluteLinks "http://www.example.com" $}
Including this in an article or file will cause all internal links in that file to be written out as absolute links, starting with http://www.example.com, instead of relative links. These links will work as long as your site is actually published at the location http://www.example.com, although in this case your site is not relocatable. If you publish it somewhere else, every link will go to www.example.com.
One More Way To Do It
You can also use the form:
{$ withAbsoluteLinks "/" $}
Notice the forward slash. This causes internal links to be written out as absolute links that are relative to the top level of the current site, for example /folder/article. Use this if you want your site to be relocatable to any URL, but it will always be at the top level within that URL, never in a subdirectory.
©Copyright 2001-2003 Fog Creek Software, Inc. All Rights Reserved.