The blog generator is intended to be quite flexible, within the design constraints, which has lead to a large number of possible configurations, both on the lisp side, and for Emacs. Drafts can be written using any editor, but I shall describe use with Emacs. The package has only been tested with SBCL, but should work with any common lisp implentation.

Prerequisites

The blog generator uses CXML, Elephant, CL-FAD, Local-Time, and Stefil for testing. I am using clbuild to obtain these.

For Emacs, I use nXML mode.

Configuration Environments

A configuration switching method is included in the package, but it's use is optional, and as is usual for lisp, configuration is through special variables.

For an example of using the configuration environments, look at the config.lisp file loaded by the my-blog.asd system. This defines the three environments that I use, :test, :development, and :production. Configurations are defined using SET-ENVIRONMENT and activated with CONFIGURE.

Basic Configuration

The first configuration required is the choice of file system locations for the published posts (*PUBLISHED-PATH*), the generated web pages(*SITE-PATH*) and the page templates (*TEMPLATE-PATH*). Drafts can exist anywhere, and are not tracked by the generator.

Next, the web paths need to be configured. The path of the blog's index file relative to the site root is required (*BLOG-ROOT-PATH*), as is the domain of the site (*BLOG-DOMAIN*), in order for it to be used in the Atom feed.

Finally, the database connection expression is required (*BLOG-DB-SPEC*). Please refer to the Elephant documentation for your choices here. I use postgres, but it should work with the BDB backend as well.

Templates

The site requires three templates in *TEMPLATE-PATH*; for the index file (index.html), for the posts (post.xhtml) and for the Atom feed (atom.xml). The templates are very simple - each div or span with a recognised id has content injected into it. The recoginised id's are:

  • posts - replaced with the current post synopses, and links to the posts
  • post - replaced with the current post's content
  • post-title - replaced with the current post's title
  • post-when - replaced with the current post's published date
  • post-update - replaced with the current post's updated date

For the Atom feed, the updated element is filled out correctly, and the posts are automatically inserted, ie. there are no special id's.

source Hugo Duncan
Hugo Duncan

Blog Generator Configuration
Written: 4-3-2009
Tags: