A static website generator - Toss some content, templates, and media in a pan and fry it up!
Switch branches/tags
Nothing to show
Pull request Compare This branch is 309 commits behind mythmon:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



wok is a static website generator. It turns a pile of templates, content, and resources (like CSS and images) into a neat stack of plain HTML.

The idea is that you don't need a big server-side engine like PHP to generate every page every visit: you can generate them all ahead of time, and only regenerate things when something has changed. A good way this could be done would be with a post-commit hook on a git repository containing your content or layout.

I made wok because projects like Jekyll, Hyde, and Static were intriguing, but in the end didn't quite match what I wanted to do with my website. So I am writing my own.

Sample Sites

A bare bones site is included in the wok git repo, in the sample directory.

For some real world examples check out these sites.

  • robmd.net (source) - Personal website of Rob McGuire-Dale.
  • Bravo Server (source) - A custom Minecraft server written in Python.
  • uberj.com (source) - Personal website of Jacques Uber
  • Your site here! If you are using wok to generate sites, and don't mind serving as an example, let me know and I will add a link to your site here.


Note that wok is in alpha. It is under active development; Its features are still in flux, and there are probably bugs. That being said, it is still quite usable. The recommended way to install wok is from the Python Package Index with this command.

sudo pip install wok

Alternatively, if you want to hack on wok or just need the latest code, you can run from git head, and if you want to you can install to your system directories with this command. Note that you will need to install dependencies by hand in this case.

sudo python2 setup.py install

###Dependencies All dependencies are available from pip. Although optional, you really should install either markdown or docutils.


  • pyyaml
  • jinja2


  • markdown - for rendering markdown documents.
  • docutils - for rendering reStructuredText documents.
  • pygments - for syntax highlighting.


To use wok, go to the directory where your site files are located, and issue the command wok. For now, no output will be given unless something goes wrong. If it returns without error, you should have a shiny new output folder containing some HTML, and your media that represents your shiny new site.

To aid in testing links on the site, wok includes a development server. The comments on that particular file say:

Do NOT attempt to use this as anything resembling a production server. It is meant to be used as a development test server only.

This test server is slow, and likely insecure, but for local testing of the site during development, it is really convenient.

wok pulls the pieces of your site from three places. For each of these places, you can modify the path wok looks for them in the config file.


Pulled from a directory named content by default. Content is written in lightweight markup or in plain text, with an optional YAML header section. The directory structure of the file mean nothing to wok. It builds the structure of the site based on the titles and the category meta data.

Since wok uses lightweight mark up languages like Markdown and reStructuredText, it is easy to do nice formatting in the pages without using a GUI editor or a cumbersome language like HTML. Built in syntax highlighting and media copying make things even easier.

More info


Pulled from templates by default. wok uses Jinja2 templates, with various variables exposed to build pages. This is a very flexible templating environment with control flow, filters, and other ways to slice and dice the data that wok gives you.

More info


Pagination requires teamwork from both the templates and the content of a page. In the content, place a new item, pagination, with sub-items limit and list. Optionally you can also include sort_key and sort_reverse.


title: Pagination Test
    list: page.subpages
    limit: 3
    sort_key: slug
    sort_reverse: True
Let's test pagination.

Then the template for this page will get a new variable pagination with useful things like pagination.page_items and pagination.next_page.

More info


Media is pretty simple. It is intended to be used for things like site wide images, style sheets and javascript. wok will copy everything from the media directory straight to the output directory before generating anything. This means that generated content can overwrite media.


Settings can be changed in the file config in the current directory.

Possible configuration options (and their defaults) are

  • output_dir ('output') - Where the outputted files are put.

  • content_dir ('content') - Where to find the content.

  • templates_dir ('templates') - Where the templates are.

  • media_dir ('media') - Where the media files are copied from.

  • site_title ('Some Random wok Site') - Available to templates as site.title.

  • author (No default) - Fills site.author, and provides a default to page.author.

  • url_pattern (/{category}/{slug}.html) - The pattern used to name and place the output files. The default produces URLs like /category/subcategory/foo.html. To get "wordpress style" urls, you could use /{category}/{slug}/index.html.

    Available variables:

    • {category} - The category of the site, slash seperated.
    • {slug} - The slug of the page.