Site Colophon
Definition
The word "colophon," for anyone wondering, means:
An inscription placed usually at the end of a book, giving facts about its publication.
Source: dictionary.com
The following is an explanation of the "framework" in use that helps to separate content and presentation, making maintenance of the site easier.
Includes and Transforms
The content on this site is served up by a combination of server-side includes and XML transformed via XSLT. Most of the content is dynamic in nature, but some does not change as often and is therefore suited to a static include.
A nice picture
Sometimes it's easier to explain visually. The process runs left-to-right, with data being stored in XML and static HTML files where appropriate.
XML Data
The three main XML data sources include the entry content (basic copy/markup, eg. what you're reading now,) the entries index (a list of entry references for the building of the navigation) and the banners index - which is transformed into a static Javascript file for later reference by the web browser.
Transform Data
The transforms shown simply apply XSL documents to the relevant XML files, and write the results to HTML/JS files as linked in the next section. The nav index transform references multiple content XML files in order to parse individual entry details; the index is merely a list of references which the nav is built with.
The index transform also creates meta includes for the articles, so that the meta keywords can be unique for each page.
Static/Generated Data
These files are the result of transforms or are static data. The colored ones are dynamic and are recreated only when the source XML changes, in order to avoid un-necessarily calling a transform procedure for every visit to the site.
Output Data
After the content has been generated, it is compiled by an include handler and is then sent out to the browser. After the initial transform, the only server-side calls required are includes; the transform does not occur again until the source XML has been modified (ie. updating existing content or adding new content.)
Displaying an article
Once the transforms have been called and the required includes generated, compiling a page is little more than calling includes for header, content and footer sections.
The URL where this article can be found, for example, is /content/entries/2004/03/14/colophon/. The server-side process is as follows:
- /content/entries/2004/03/14/colophon/
- Call include handler
- /include_handler/
- Include generic header
- Include specific meta tags
- Include specific content
- Include generic footer
Using this method, only one handler exists for all of the content on the site - making global changes easy. A potential drawback is that each entry's XML file resides in a unique directory; however, this also gives flexibility to naming as well as reinforcing content separation and structure.