skip to primary navigationskip to content

Department of Computer Science and Technology

Web servers and sites

 

House-style formatting (ucampas)

Formatting HTML pages in departmental house style

The Ucampas HTML formatting tool is available on the departmental filer to give filer-served web pages a common house style and navigation structure. It is used to format many parts of the main filer-hosted web site, and can also be used to format research-group pages, personal web pages, websites of other departments, etc.

Getting started

Ucampas reads a simple, undecorated file named something-b.html and generates from that a file named something.html. The former (*-b.html) file is intended for human editing, the latter will be served by the web browser.

The input file should be a normal plain web page (HTML 4 or XHTML 1), such as

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<title>Document title</title>
<h1>Main heading</h1>
<p>Some text ...
<h2 id="section1">A section heading</h2>

Save this example file as test-b.html. Then type into the shell the command line

/anfs/www/tools/bin/ucampas test

The input file test-b.html is now read in, transformed to match the house style and written out as test.html, which you can then view with a web browser.

For convenience, you can add "/anfs/www/tools/bin" to your $PATH environment variable. Or you can place into any directory where you have web pages a Makefile of the form

%.html: %-b.html
	/anfs/www/tools/bin/ucampas $*

all: index.html

This way you only have to type "make filename.html" to call ucampas. More on make ...

Configuring your page style

You may now want to add a uconfig.txt file in the top-level directory of your site (e.g., ~/public_html/uconfig.txt for a home page), where you can tweak and personalize many house-style parameters, e.g. as in

style=ucam2012(colours=red),
webmaster=(name='Markus Kuhn',
           url='https://www.cl.cam.ac.uk/~mgk25/'),
copyright_holder='Markus Kuhn',
section='Dr Markus Kuhn',

You currently have a choice of three house styles: ucam2012, ucam2008, ucam2006, and some of these come in different color schemes. See the reference manual for the configuration parameters, and the style documentation for some more.

Default style: The “blue” theme of the ucam2008 style has been the default since 2010-07-22, but this may change, so if you want to keep it, make sure you choose it explicitly with “style=ucam2008,”.

Choosing your parent page

You can also tell ucampas that the directory in which your page is located should be treated as if it were the subdirectory of another part of the web site, such that your page inherits the navigation structure (menus, breadcrumbs, style settings, etc.) of that other part of the site. To do so, create a single-line text file ..u containing that directory path. Ucampas will then use that instead of .. to locate the parent folder when it scans the site structure. For example, if you want your home page to look as if it were located under the departmental front page at /anfs/www/html, use the shell command

$ echo /anfs/www/html >~/public_html/..u

Or if you want it to appear under the members page of a research group, point ..u e.g. to /anfs/www/html/research/security/people.

Previously this file was called u.. and it could also be a symbolic link. But trailing dots and symlinks caused problems for Windows users and symlinks also created unintended access paths. Therefore please change any old u.. symlinks that you might still have into the newer ..u single-line text file.

Advanced functions

Ucampas can do lots more for you, including automatically generating hierarchical navigation bars, breadcrumbs, tables of contents, file listings, news bulletins from RSS feeds, etc. If you have sub pages, just list their filenames separated by commas in a uconfig.txt file in the same directory. There are also lots of configuration options. The reference manual provides all the details. Ucampas developer Markus Kuhn is also often happy to give quick personal tutorials.

Migration from previous “template” system

Ucampas replaced the older /anfs/www/html/UoCCL/template/install.pl script that was used before 2007. If you still have an existing something.tmpl file for that older script, there is a quick migration path. Simply call

/anfs/www/html/UoCCL/template/install.pl -b something

This will write a something-b.html file suitable for input to ucampas. If ucampas doesn't like that as input, you probably had some HTML syntax errors on your old page. The HTML Validator or /anfs/www/tools/bin/htmlcheck can help you to fix these.