Static Website Toolkit (swtk)

swtk is a toolkit that allows to easily create all the HTML documents of a (static) website. For convenience and ease of use, it utilizes templates and Markdown syntax.

Table of contents

About

The static website toolkit (swtk) provides an easy way to build and maintain a static homepage. It features the use of templates and Markdown enabled content files that allow to abstract content and layout to a high level.

swtk allows you to...

swtk is written in Perl and uses flat files only - no database needed.

Example usage

Imaging you store your website in a directory structure as follows:

.
|-- example.cfg
|-- data/
|-- swtk-data/
|   |-- disclaimer.swtk
|   `-- index.swtk
`-- templates/
    `-- default.tmpl

example.cfg stores a set of varibale definitions, like the URL and name of your website, the content's default author, default CSS files to be referenced and whatever else you may need to define. Beside that, the configuration file allows to set all necessary options for swtk, so the amount of information to pass on the commandline can be reduced to just specifing the configuration file!

data/ is the directory the documents of your website will be stored to. You can copy images, CSS files and everything else you need for your website there as well - think of it as the directory that will be copied to your webspace.

swtk-data/ stores all the content files that are processed by swtk in order to generate HTML documents. At the beginning of each .swtk file, custom variables may be defined. These variables preceed the defaults defined in the configuration file and can be referenced within the templates. The rest of the file is interpreted as being in Markdown syntax - but you can of course put any HTML code in there, too. Beside that, it is possible to set the template to use there, too.

templates/ stores all your website's templates. Variables can be interpolated within a template and Perl code can be embedded to automate most tasks, like building breadcrumbs and displaying submenus according to each document's path or URL. The default template is applied to all content files that don't specify to be processed by a custom template.

To build all the documents according to the global and specific parameters, the following command invocation in sufficient:

$ swtk -c example.cfg 
Reading configuration from example.cfg...
001/002: swtk-data/disclaimer.swtk
002/002: swtk-data/index.swtk
Processed 2 input files.
Generating sitemap.xml... 1 entries.

After swtk has processed all available input files, the directory structure is as follows:

$ tree
.
|-- data
|   |-- disclaimer.html
|   |-- index.html
|   `-- sitemap.xml
|-- example.cfg
|-- swtk-data
|   |-- disclaimer.swtk
|   `-- index.swtk
`-- templates
    `-- default.tmpl

For in-depth information on swtk's parameters and configuration file, have a look at the manpage!

Requirements

To install and use the static website toolkit, the following software packages are necessary:

swtk uses flat files only. As a result, no database is needed.

Download

swtk is released under the terms of the BSD license as stated (here).

The current stable version of swtk is 0.1 - [Download] [MD5sum] [Signature]

My public key can be imported from here or automatically using a public keyserver. The keyid is 0x90ACCB01.

I am planing to release Debian and Solaris packages as well in the near future...

Author

The static website toolkit is developed and maintained by Alex Linke. Suggestions and patches are welcome!

Credits

Thanks to...

...Rona Linke for contributing swtk's manpage and testing the software!

...John Gruber for Markdown and its convenient syntax!

Links