StatiCMS Configuration
The configuration file defines the plugins that will be used to build the content. Let's look at an example configuration:
sourcedir="/home/tim/projects/staticms-website/src" targetdir="/home/tim/projects/staticms-website/tgt" pages = plugin("mwpage") pages.sources = [ "/*.wiki" ] pages.excludes = [ ".svn/*" ] pages.template = "staticms.tmpl" pages.menu = "staticms.menu" cssfiles = plugin("copy") cssfiles.patterns = [ "*.css" ] cssfiles.excludes = [ ".svn/*" ] images = plugin("copy") images.patterns = [ "*.png" ] images.excludes = [ ".svn/*" ]
In this file, which was used to generate the StatiCMS website, I have defined three plugins. For each plugin I have defined attributes, for example, I have told the pages plugin that it should look for all files ending in /*.wiki, by setting the pages.sources attribute. The attributes that are used by a plugin are defined by the plugin.
The two variables at the top of the file are required: sourcedir and targetdir. They tell staticms where to find the sources and the directory where the resulting targets should be placed. For example, the pages plugin will find /home/tim/projects/staticms-website/src/manual/config.wiki and convert it to /home/tim/projects/staticms-website/tgt/manual/config.html. It is possible for a plugin to override these values, but these two values should always be present. If a plugin attribute is not specified, staticms will look for a variable with the same name. If there is no such variable, a default value is used. For example, the attribute pages.menu_template is not set. StatiCMS will look for a variable menu_template, but this is not defined. Therefore, the built-in default value will be used.
The plugins that are defined should be loaded, otherwise an error message is given. StatiCMS uses a hardcoded directory to find the plugins. To load additional plugins from the configuration file, use the following command:
LoadPlugins("/some/other/dir")
While looking simple, the configuration file is actually a little Python script. Therefore, you can use the full power of Python in your configuration file to create really sophisticated configurations.