How gotgoat is made
As a PMC member of Apache Forrest, it would have been natural to use Forrest to build this site. But to get a different perspective on Forrest and on site generation in general, I took a different approach.
I'm not a fan of browser-based CMS, so that option was not considered this round. Maybe next time.
Source format
The sources for everything but the blog are in an XML format similar to XDoc used in Forrest. I'm not using any DTD or schema at this point. As the format evolves, I make adjustments to the stylesheets as necessary. I may add validation against a schema when the format is more stable, but for now my text editor and the build process ensure the documents are well-formed.
Blog format
The blog posts are all contained in a single XML file. When this file is processed by a separate XSLT stylesheet, the directory structure of the blog (dates and categories) is created as well as index files for the categories. An index file is made up of XInclude elements which reference the individual posts, to be processed later.
Build process
The build process is carried out by a single Apache Ant script. The script uses the XSLT task for the main stylesheet, but the blog is handled separately by external calls to xmllint and xsltproc from libxml/libxslt for XInclude and EXSLT support.
The source content is mirrored into a staging area to simplify some of the later steps and to keep the source unmodified by the build process.
Then the blog file is processed into individual posts, such as:
2010/07/04/new_goat.xml
and referenced by XInclude in a category:
software/index.xml or linux/index.xml
The main index is a running list of XInclude elements for all posts, newest to oldest.
A script is called to process and expand any XInclude elements found in the source.
The staging area content is passed through the main XSLT, converting the source XML to XHTML while adding the layout and design to the output.
The output of the last step is processed by HTML Tidy for formatting and to repair any small mistakes. This step also prevents major errors from getting through.
Finally, static content is added to the output of the previous steps.
Conclusions so far
The build script and stylesheets could use some refactoring and general housecleaning, but I'm pleased with the process and the speed of test cycles in the current state. Rebuilding the site after adding this conclusions section: BUILD SUCCESSFUL Total time: 3 seconds. Three seconds to generate the site from a clean slate. Not too shabby.
Apache Forrest and Apache Ant are trademarks of The Apache Software Foundation. All marks used on this page are the property of their respective owner.
