20.2 Solution

The easy way is to use absolute file names, but they bring a lot of problems when moving or upgrading sites. A more subtle solution is needed: header.cws shouldn't make any assumption about its location within the directory tree since its content can be included from different files with different locations.

So we can refer to images and links as if they were seen from site's root directory (in our example /your-site/) and place a variable number of ../ sequences before. How many ../ sequences you need ? Exactly the number of directories traveled to reach the output file from the root directory.

In our example, assuming that every output file is created in the same directory of the respective source:

  1. when header.cws is included from /your-site/index.cws you need no ../ since the output file is in the root directory;

  2. when header.cws is included from /your-site/docs/docs.cws you need one ../ sequence since the output file is in a subdirectory;

  3. if header.cws is included from /your-site/docs/pdf/pdf.cws you need two ../ sequences since you need two steps down in the directory tree to reach the output file.

The number of sequences will be evaluated by Cows while including the file, once you request it by the mean of the linkadjust () function.

This manual can be downloaded from http://www.g-cows.org/.